Printing a char array does not display a hash code:
class IntChararrayTest{
public static void main(String[] args){
int intArray[] = {0,1,2};
The other answers correctly explain your case of a separate call to PrintStream.println
and the same is true for .print
. However your title could cover other ways of printing. PrintWriter.println
and .print
AND .write
do have char[]
overloads for a simple call.
However, formatting does not have a special case:
System.out.format ("%s%n", charArray); // or printf
myPrintWriter.format ("%s%n", charArray); // or printf
each outputs [C@hash
, similar to the handing of int
and other type arrays.
Nor does concatenation, often used in printing:
System.out.println ("the value of charArray is " + charArray);
outputs the value of charArray is [C@hash
.