[Solved] Java: Variable is already defined in method main


As the error says, you have int max declared twice. You need to change the second one to a variable assignment, not declaration:

 int max = i;

 for(int j = i+1; j < 1; j++)
 {
   if (wholeNumber[j] > wholeNumber[max])
   {  
      max = j; // NOT: int max = j;
   }
 }

0

solved Java: Variable is already defined in method main