Char [] ch={' H ', 'e', 'l', 'l', 'o'};
System. The out. Println (ch);
Char [] chars={' H ', 'E', 'L', 'L', 'O'};
System. Out.println (" why this print is address values?" + chars);
}
Results: after the output
Hello
Why is this print is address values? [21 bcffb5 C @
Why can the first normal, according to the second with a passage printed value is the address?
Solution,
CodePudding user response:
You look at the PrintStream class of API descriptionPrintln (char [] x)
Println (String) x
In simple terms, the former press string printed in the form of an array, the array into a string object (the default toString method calls, the default toString method returns the object types @ hash value) to print
CodePudding user response: