-1

I keep getting back a hash value when trying to return a single value i have tried a number of different thing yet to luck

private static void displayHighestScores(int[] walkingScores, int[] groomingScores,
        int[] overAllscore, int  numberOfCompetitors)
{
    findMax(walkingScores, groomingScores,  overAllscore, numberOfCompetitors);
    printTitle();
    System.out.println("The best walking score is " + walkingScores.toString());
    System.out.println("The best grooming score is " + groomingScores.toString());
    System.out.println("The best overall score is " + overAllscore.toString());



}
private static int findMax(int[]walkingScores,int[] groomingScores,int[] overAllscore, int numberOfCompetitors){
    int i;
    int lowest = Integer.MIN_VALUE;
    for (i = 0; i < numberOfCompetitors; i++){
        if (walkingScores[i] > lowest)
            lowest = walkingScores[i];
    }
    return i;

}


it is printing out this :

Village Dogs Competition 2014

The best walking score is [I@2a08d18c

The best grooming score is [I@28f553e3

The best overall score is [I@2567117

Press Return to continue

bbaayy
  • 5
  • 2

1 Answers1

1

The method is fine, you're just printing it out wrong.

Instead of calling .toString() on arrays, use Arrays.toString(array), e.g.

System.out.println("The best walking score is " + Arrays.toString(walkingScores));
Louis Wasserman
  • 191,574
  • 25
  • 345
  • 413