Arrays

Compare Two Java char Arrays Example

Want to learn quickly?
Try one of the many quizzes. More than Java 400 questions with detailed answers.

Add Comment

  • Do this Using Array of Staring, Get Username and ph no from the user in run time and store it. User then should be able to find out the user name for given ph and vice versa..
    Array of string*

  • public class GlobalMembersStringtoint
    {
    public static int Main()
    {
    int k = 0,m,n,eleCount,i,j,count = 0,ch;
    int[] newarray = new int[90];
    String String = new String(new char[100]);
    String pattern = new String(new char[10]);
    System.out.print(“enter the string \n”);
    fgets(String, 100, stdin);
    System.out.print(“enter the pattern \n”);
    fgets(pattern, 100, stdin);
    m = pattern.length() – 1;
    System.out.printf(“\n the length of pattern = %d”,m);
    n = String.length() – 1;
    System.out.printf(“\n the length of string = %d”,n);
    eleCount = n – m;
    System.out.printf(“\n number of substrings = %d”,eleCount);
    for (i = 0;i <= (n – m);i++)
    {
    num = 0;
    k = i;
    for (j = 0;j < m;j++)
    {
    temp = (int)String.charAt(k);
    num = num * 10 + temp;
    k++;
    }
    newarray[i] = num;
    System.out.printf(“the value of new array = %d \n”,newarray[i]);
    }
    num = 0;
    for (j = 0;j < m;j++)
    {
    temp = (int)String.charAt(k);
    num = num * 10 + temp;
    }
    System.out.printf(“number = %d \n”, num);
    return 0;
    }
    }

    friends
    help me to convert this code into java

    i am getting problem ……

Sponsors

Facebook Fans

Online Shopping – Flipkart