I am working on a java code where it should prompt the user to input the grades of N amount of students and it should output the highest grade, My code is working well but I want to give the user ability to enter the content of the array and I want to create a data type called Student for example for the array.
public class Test3 {
   static double grades[] = {85, 99.9, 78, 90, 98};
       
   static double largest() {
      int i;
      double max = grades[0]; 
      for (i = 1; i < grades.length; i++)
         if (grades[i] > max)
            max = grades[i];
        
      return max;
   }
   public static void main(String[] args) 
   {
      System.out.println("Highest grade is :  " + largest());
   }
}
Any help would be really appreciated.
                        
First, you should create the Student class:
To avoid repetitive code, you can use the Lombok library. It creates for you the constructors, getters, setters, toString(), and much more.
After, you can create a method to input students grades.
And... using your already made max finder, but returning the Student instead.
Now we just need to call these methods in main().