Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - The problem of printing JAVA character arrays and integer arrays.
The problem of printing JAVA character arrays and integer arrays.
Just look at the source code of the printing method,

If you print a char array, the print method calls the write method directly. Equivalent to direct splicing printing.

And if you print an int array, he will call String.valueOf(obj) before calling the write method. So the address is printed.

If you want to print out the values in the int array, you can use loops.

for (int i : arr2) {

system . out . println(I);

}