How to call a public instance data from another class?
<p>So i have set the student's class instance data to public so that i can call it from the CourseInfo class like this </p>

<p>students[studentCount].studentID(); </p>

<p>but it doesn't work ! can someone please explain how to call only the class instance data from another class ? i don't want to make more methods, so is there a way to do it ?</p>

<pre><code>public class Student
 {

    static Library myLib;

    //instance data
    Public String studentID;
    Public float grade;
    Public String result;
    Public String email;


    public Student(String studentIdNum, String status, String emailAdd)

    {
        studentID = studentIdNum ;
        result = status;
        email = emailAdd;
        grade = 0;

    }
</code></pre>

<p>and</p>

<pre><code>public class CourseInfo
{


        //instance data
        Student students[] = new Student[2];

      public void AddStudent()
      {


         //Local variables

         String id;
         String email;
         String status;
             int studentCount = 0;

         /*************************************/

         System.out.print( " enter id     :" );
         id = Keyboard.readString();

         System.out.print( " enter email  : ");
         email = Keyboard.readString();

         System.out.print( " enter status : ");
         status = Keyboard.readString();


         students[studentCount] = new Student(id, email, status);

         students[studentCount].studentID();
         students[studentCount].result();
         students[studentCount].email();



         studentCount++;



      }


}
</code></pre>
