String.equals()
method in Java compares the backing arrays of two strings. So if the arrays are of different size same strings would not be equal.
Example:
char[] in = new char[50];
in[0] = 'K';
in[1] = 's';
in[2] = 'h';
in[3] = 'i';
in[4] = 't';
in[5] = 'i';
in[6] = 'z';
String s = new String(in);
System.out.println(s.equals("Kshitiz"));
Output:
false