What is wrong with this code I\'m getting wrong output. I don\'t know what\'s wrong, I hope you could help me:
public class Main{
public static void main(Strin
The output is completely fine. The arrays don't override toString()
method, so it invokes the Object#toString() method, which generates that kind of representation. The output is of the form:
getClass().getName() + '@' + Integer.toHexString(hashCode())
For arrays, the Class#getName() method uses some encoding for different element type to generate unique class name. The encoding rule is specified in the documentation.
To get the human readable representation, you can use Arrays#toString() method:
System.out.println("numbers are"+ Arrays.toString(data));