Here\'s the problem. This code:
String a = \"0000\";
System.out.println(a);
char[] b = a.toCharArray();
System.out.println(b);
returns
An array's toString()
method (which is what's called when you do "..." + b
) is only meant to give debugging output. There isn't a special case where a char[]
's toString()
will give you the original string - arrays of all types have the same toString()
implementation.
If you want to get the original string from the char array, use:
String a2 = new String(b);