import java.util.Scanner;
public class Highest{
public static void main (String [] args){

Scanner kb = new Scanner(;

int scores [] = new int[3];
String names [] = new String [3];
int highest = scores [0];
String names1 = names [0];

for (int i = 0; i<3; i++){
   System.out.println("enter name and score: ");
   names[i] =;
   scores[i] = kb.nextInt();
      if (scores[i] > highest)
         highest = scores[i];
         names1 = names[i];


System.out.println(highest + names1);


i'm stuck on the part where i have to extract the name that associates with the highest score. it always prints out the last name that i enter instead of the one with the highest score.

This question has already been answered. Start a new discussion instead.