toString()
is called on an array.
In most cases, a call to toString()
on an array indicates a developer is interested in returning the contents of the array as a String. However, a direct call to toString()
on an array will return a string value containing the array's type and hashcode in memory.
Example 1: The following code will output [Ljava.lang.String;@1232121
.
String[] strList = new String[5];
...
System.out.println(strList);
[1] Class Arrays Sun Microsystems
[2] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 398