-1

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

output

eShad0
  • 43
  • 5

2 Answers2

0

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.

Andres Sacco
  • 650
  • 3
  • 13
0

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.

ShrubtheBub
  • 126
  • 2
  • 5