Hi so I have an object that has an array in it however when i try to print the the array itself it prints [Ljava.lang.String;@7637f22
I assume i am not calling it right and would like to know how i may go about doing so? code
Hi so I have an object that has an array in it however when i try to print the the array itself it prints [Ljava.lang.String;@7637f22
I assume i am not calling it right and would like to know how i may go about doing so? code
You could use
System.out.println(Arrays.toString(j.controls));
this code iterates each element of the array and uses the method toString to show the contentelement.
Java has a method called Arrays.toString(arr)
that basically prints the array. You would replace arr
with the actual array name. In other languages such as Python, if you print a list, it prints the contents of it directly. That is not the case in Java. The explanation to why this happens is here.