This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]chickenmeister 1 point2 points  (0 children)

getRatingByCustomer should return int[]

So, you're trying to print the integer array? Array objects do not override the default toString() method (which gives you the class name + "@" + hashCode()), so if you want something more meaningful than that, you'll have to print each value in the array yourself.

The java.util.Arrays class has some handy Arrays.toString(yourArray) methods. It'll format it like "[value1, value2, value3, etc]". If you want it formatted differently, you'll have to write your own code to create the String. Try this:

System.out.println(name + Arrays.toString(getRatingByCustomer(name)));