Tuesday, July 23, 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

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...