I've been trying and seeking for questions which are similar to mine for almost 2 days hope I will find out the answer, but no, I couldn't so I decided to ask you guys here.
This method is to print out all the keys and values of a HashMap<String, int[]>
ratingmap
. So keys are String
s and values are arrays. I've been working on that and below is my code.
public void showRatingsMap() {
for (String customer: ratingmap.keySet()) {
String key = customer.toString();
int[] value = ratingmap.get(key);
System.out.println("Customer: " + key + " - Rating: " + value);
}
}
I'm really confused at the moment because the result which is printed out looks like this:
Customer: Douglas Anderson - Rating: [I@4f5b571e
Customer: Sidney - Rating: [I@75b49b45
Customer: Apollo - Rating: [I@243e0b62
Customer: Leslie - Rating: [I@655d6184
As I expect the rating to be an array, but it always appears as the weird combination above: [I@2b9fd66a
Could anyone please point out the mistakes that cause the problem?