0

Print out object in Java

I have an integer and an integer that I get from a hashmap stored in an array called finalAns. int[] finalAns = {}; finalAns = new int[] {i, (int) map.get(ans)}; System.out.println(finalAns); When I print it out I get [I@77459877 But System.out.println(i) gives 1 and System.out.println((int) map.get(ans)) gives 3 How do I get [1,3] when I print out the final answer?

13th Jul 2022, 6:49 AM
NazmusSaqueebAshrafi
1 Answer
+ 2
NazmusSaqueebAshrafi System.out.println(Arrays.toString(finalAns));
13th Jul 2022, 6:58 AM
A͢J
A͢J - avatar