title: Java : Storing Data in Array Of Object from JOptionPane Dialog
body: <p>I need to know how I can insert data inside objects inside an array of objects using my already made Set methods.</p>
  
  <p>i need to know how should i do it through user , i mean JOptionPane input dialog</p>
  
  <pre><code>student[] s = new student[5];
  
  for (int i=1 ; i &lt;= s.length ;i++) {
      s[i] = new student(i,"AAA","Ecommerce",0.0);
  }
  
  for (int i=1; i&lt;=s.length;i++) {
      name = JOptionPane.showInputDialog("Please Write Name for student n " + i);
      major = JOptionPane.showInputDialog("Please Write Major for student n " + i);
      gpa = Double.parseDouble(JOptionPane.showInputDialog("Please Write GPA for student n " +i));
  
      s[i] = new student(i,name,major,gpa);  
  }
  </code></pre>
  
  <p>I tried to do vars here that get data from user by JOptionPane, but it seems that i only use my already made constructor , not the Set methods.</p>
  
  <p>I need to use the methods because it has some validation code inside it.</p>
  
  <p>Any ideas?</p>