title: create instances and store them in array
body: <p>I have a student class and every student instance created needs to be stored in an array.attributes can be given in program or read from user input.how do I extend my main() method to store it? i am stuck .</p>
  
  <p>Here is my student class code:</p>
  
  <pre><code>public class student {
  
      int   studentID;
      String studentName,gender,course;
   /** set the student name
    * @param studentName
   */
   public  void        setName(String studentName){
  this.studentName = studentName;
   }
    /**
    * set student ID number
    * @param studentID 
     */
     public  void        setNewId(int studentID){
     this.studentID = studentID;
    }
     /**
     * Set student gender
     * @param gender 
     */
     public void setGender(String gender){
    this.gender = gender;
   }
   /**
    * set the course
    * @param course 
    */
     public  void        setCourse(String course){
     this.course = course;
   }
   /**
    *Gets the Student's ID Number.
    *@return IdNumber Student ID Number.
    */
    public  int      getIdNumber(){
  return studentID;
   }
  
    /**
    *Gets the Student's Name.
    *@return studentName Student Name.
    */
   public  String      getName(){
  return studentName;
   }
   /**
    * Get student gender
    * @return 
     */
   public String getGender(){
    return gender;
   }
   /**
    *Gets the Student's Course.
    *@return course Student Course.
    */
  
    public  String     getCourse(){
  return course;
    }
    /**
    *Prints Student Informations.
    *@return Student ID Number, name, gender and course.
      */
  
    public void printStudent(){
   System.out.print(studentID+""+studentName+""+gender+""+course);
  }
  }
  </code></pre>
  
  <p>And here is my main class with main() method that needs the array:</p>
  
  <pre><code>public class SMSMain {
      /**
       * 
       * @param args
       */
      public static void main(String[] args) {
      // Create an instance of student object
  
      student a = new student();
      a.studentName = "Maria";
      a.studentID = 1236;
      System.out.println("Student Name:" + a.studentName);
      System.out.println("Student ID:" + a.studentID);
  }
  }
  </code></pre>