title: How to fill Object Array and find minimum value for the Object Array
body: <p><strong>EDIT SOLUTION</strong></p>
  
  <p>Based on forpas code, I move thing around little bit, and now the minimum value displays as expected. Thank you guys for all your help.</p>
  
  <pre><code>public static StudentGrade findMinIndex(StudentGrade[] studentGrades) 
  {       
      StudentGrade studentGradeMin = studentGrades[0];
  
      for(int i=0; i &lt; studentGrades.length; i++) 
      {
          if(studentGradeMin.getGrade()[0] &gt; studentGrades[i].getGrade()[i]) 
          {
              studentGradeMin.getGrade()[0] = studentGrades[i].getGrade()[i];
  
          }                  
      }
  
      System.out.println(studentGradeMin.getGrade()[0]);
  
      return studentGradeMin;
  
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>Now that I can print out the number, I have problem with finding minimum value. I keep getting error message: 
  "The operator > is undefined for the argument type(s) StudentGrade, StudentGrade"</p>
  
  <p>I need to find minimum value for my object array, but I can't print the object correctly. The result will not display like integers.
  Can someone help me please?</p>
  
  <p>This is my text file</p>
  
  <p>6
  John 97.5
  Jim 99
  Kathy 34
  Steve 86.5
  Stacy 43
  Faith 88</p>
  
  <p>This is my methods</p>
  
  <p>//This is the constructor class </p>
  
  <pre><code>public class StudentGrade
  {   
  
        private String[] names;
        private double[] grades; // instance variable
  
  
        // constructor initializes grades with parameter grades               
        public StudentGrade(double[] grades, String[] names) 
        {                                                                 
           this.grades = grades; 
           this.names = names;
        }                                                                
        // method to set the grades
        public void setGrade(double[] grades)
        {
           this.grades = grades;
        }
  
        // method to retrieve the grades
        public double[] getGrade()
        {
           return grades;
        }
  
  
        //Set name
        public void setName(String[] names)
        {
           this.names = names;
        }
  
        // method to retrieve the names
        public String[] getName()
        {
           return names;
        }
  }
  </code></pre>
  
  <p>//This is my main class</p>
  
  <pre><code>   public static StudentGrade[] initialize(String inputFileName)   throws FileNotFoundException 
      {           
      Scanner scan = new Scanner(new FileInputStream("grade.txt"));   
  
      int size = scan.nextInt();
      String[] names = new String[size];
      double[] grades = new double[size];
      int index = 0;
      String[] col = null;
  
      while(scan.hasNextLine())           
      {
          names[index] = scan.next();
          grades[index] = scan.nextDouble();
          index++;
  
      }
  
      StudentGrade[] studentGrades = new StudentGrade[grades.lenght];
      for(int i=0; i&lt; studentGrades; i++)
      {
         studentGrades[i] = new StudentGrade(grades, names);
  
      }
  
      for(int i=0; i&lt; grades.length; i++)
      {
          System.out.println(studentGrades[i].getGrade());
      }
  
      scan.close();
      return studentGrades;
    }
  
   //This is to find minimum value
  
  public static StudentGrade findMinIndex(StudentGrade[] studentGrades) 
  {
  
      StudentGrade studentGradeMax = studentGrades[0];
  
       for(int i=1;i&lt;studentGrades.length;i++)
       {
          if(studentGrades[i] &gt; studentGradeMax) ==&gt; Error "The operator &gt; is undefined for the argument type(s) StudentGrade, StudentGrade"
          {
              studentGradeMax = studentGrades[i];
          }
        }
        return studentGradeMax;
  
  
  }
  
  The code return these values instead of real number
  [D@3d4eac69
  [D@3d4eac69
  [D@3d4eac69
  [D@3d4eac69
  </code></pre>
  
  <p>[D@3d4eac69
  [D@3d4eac69</p>