arrays - Java method returning hashcode ,i want a single value back -
this question has answer here:
i keep getting hash value when trying return single value have tried number of different thing yet 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 " + walkingscores.tostring()); system.out.println("the best grooming score " + groomingscores.tostring()); system.out.println("the best overall score " + overallscore.tostring()); } private static int findmax(int[]walkingscores,int[] groomingscores,int[] overallscore, int numberofcompetitors){ int i; int lowest = integer.min_value; (i = 0; < numberofcompetitors; i++){ if (walkingscores[i] > lowest) lowest = walkingscores[i]; } return i; } printing out :
village dogs competition 2014
the best walking score [i@2a08d18c
the best grooming score [i@28f553e3
the best overall score [i@2567117
press return continue
the method fine, you're printing out wrong.
instead of calling .tostring()
on arrays, use arrays.tostring(array)
, e.g.
system.out.println("the best walking score " + arrays.tostring(walkingscores));
Comments
Post a Comment