TermCommentPost For Java String Examples

17 Comments

  • Hi can anyone help me in a string prog i.e
    if i enter a string 123 then the output should be displayed as the entered string is Numeric.
    and if i enter the string 123abc the output should be displayed as entered string is Alphanumeric.

    please help me out regarding this i am a beginner so its little confusing !!

    • import java.util.Arrays;

      public class String4 {

      public static void main(String[] args) {

      java.util.Scanner scn=new java.util.Scanner(System.in);

      System.out.println(“enter a String:”);

      String s1=scn.nextLine();

      for(int i=0;i<=s1.length()-1;i++)

      {

      char c=s1.charAt(i);

      if((c>=65&&c<=90)||(c>=97&&c<=122))

      {

      System.out.println(“string is alpha numeric”);

      break;

      }

      else

      {

      System.out.println(“string only numeric”);

      break;

      }

      }

      }

      }

  • “i want to make approx words from given letters “
    <input>[a,b,n,m,k]
    <output>[abnmk,bnmka,nmbak……..]
    plz any one can make this coding in core java……plz post….or mail me”[email protected]

  • The actual output would be like this :

    Equal 1

    I am constructed using constructor, hence not interned

    Equal 3

    NOTE: Not Equal 2 // is wrong

    thank you

  • Hi everyone! Can you please help me with this problem?

    Negotiating a consumer loan is not always straightforward. One form of loan is the discount installment loan, which works as follows. Suppose a loan has a face value of 1000 pesos, the interest rate is 15 percent, and the duration is 18 months. The interest is computed by multiplying the face value of 1000 pesos by 0.15 to yield 150 pesos. The figure is then multiplied by the loan period for 1.5 years to yield 225 pesos as the total interest owed. The amount is immediately deducted from the face value, leaving the consumer with only 775 pesos. Repayment is made in equal monthly installments based on the face value. Thus, the monthly loan payment will be 1000 pesos divided by 18, of 55.56 pesos. This method of calculation may not be too bad of the consumer needs 775 pesos, but the calculation is a bit more complicated if the consumer needs 1000 pesos. Write a program that will take three inputs: the amount the consumer needs to receive, the interest rate, and the duration of the loan in months. The program should then calculate the face value required in order for the consumer to receive the amount needed and should also calculate the monthly payment.

  • Hello plz help me in a string prog i.e

    if i enter a string “JAVA”, it should print “KBWB” i.e. next character of each input string

  • Just curious why you are incorrectly using uppercase in your code, Though I am very impressed with the lesson here with the constructor .. thank you for that good bit of information!

  • Hi can anyone help
    String price=”$200″;
    String quantity=”5″;
    int actualresult=1000;
    int expectedresult

    Not able to find any matching example
    tried every string function

Sponsors

Facebook Fans