In Java toString, an array is printed [, then a character representing the type of the array element ( Cin this case), and then the hash code of the identifier. So, in your case, are you sure that it returns the original string, and not something like [C@f4e6d?
, new String(arr). , char[] String. Arrays.toString(arr)
, arr.toString() - [Cf4e6d, , Object.toString
getClass().getName() + '@' + Integer.toHexString(hashCode())
char getName() [C. :
System.out.println(arr.getClass().getName());
Object.hashCode() , , . , "" , .. , . arr.toString() :
String s = "fdsa";
char[] arr = s.toCharArray();
char[] arr2 = s.toCharArray();
System.out.println(arr.toString());
System.out.println(arr2.toString());
:
[C@4b7c8f7f
[C@5eb10190
, String, , . , string1.equals(string2) , ==, == .