Tuesday 23 July 2019

Why does printing a Java array show a memory location

int[] answer= new int[map.size()];  
HashMap map = new HashMap();

for (int j=0; j int x=map.get(keys.get(j));
answer[j]=x;
}

return answer



When I print x using System.out.println(x) in the loop, I get values of 1, 2, 3 but when I return the answer and print it, I get [I@9826ac5. Any idea why?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...