Cant get my output
<p>For some reason i keep getting the same output for my courses. when i print out it only shows the final input.
i should have input a student id with 2 course's id, credit hour and grade. however when i displaying the output i only getting the final input course data. i don not see the 1st wan....</p>

<p>here is the coding:</p>

<pre><code>  public class CollegeCourse
{
    private String courseID;
    private int creditHours;
    private String grade;

    public String getCourseID()
    {
        return courseID;
    }

    public int getCreditHours()
    {
        return creditHours;
    }

    public String getGrade()
    {
        return grade;
    }

    public void setCourseID(String ID)
    {
        courseID = ID;
    }

    public void setCreditHours(int cHours)
    {
        creditHours = cHours;
    }

    public void setGrade(String gd)
    {
        grade = gd;
    }

    public CollegeCourse()
    {
        courseID = "CSI 000";
        creditHours = 3;
        grade = "A";
    }
}

public class Student
{
    int count = 0;
    private int IdNumber;
    private CollegeCourse [] courses = new CollegeCourse[2];

    public int getIdNumber()
    {
        return IdNumber;
    }

    public void setIdNumber(int IdNum)
    {
        IdNumber = IdNum;
    }

    public CollegeCourse getCourses(int count)
    {
        return courses[count];
    }

    public void setCourses(CollegeCourse cour, int count)
    {
        courses[count] = cour;
    }

    public Student()
    {
        IdNumber = 1111;
    }
}
</code></pre>

<p>this is the application drive:</p>

<pre><code>import java.util.Scanner;

public class InputGrades
{
    public static void main (String[] args)
    {
        int n=0, s=0;
        int i,j;
        int id;
        String courseID;
        int credHour;
        String grad;

        Student [] year1 = new Student [1];
        CollegeCourse course = new CollegeCourse();

        Scanner input = new Scanner(System.in);

        for(i=0;i&lt;year1.length;i++)
        {
            year1[i] = new Student();
        }


        for(i=0;i&lt;year1.length;i++)
        {
            System.out.println("Enter ID for student #" + (s+1));
            id = input.nextInt();
            year1[i].setIdNumber(id);
            s++;
            n=0;

            for(j=0; j&lt;2; j++)
            {
                System.out.println("Enter course ID #" + (n+1));
                courseID = input.next();
                course.setCourseID(courseID);

                System.out.println("Enter the course credit hours ");
                credHour = input.nextInt();
                course.setCreditHours(credHour);

                System.out.println("Enter the grade");
                grad = input.next();
                course.setGrade(grad);
                n++;

                year1[i].setCourses(course, j);
            }

        }

        System.out.println();

        for (i=0; i&lt;year1.length; i++)
        {
            System.out.println("Student ID: "+year1[i].getIdNumber());

            for (j=0 ; j&lt;2; j++)
            {
                System.out.println("Course ID: "+year1[i].getCourses(j).getCourseID() +"\nCredit Hours: "+ year1[i].getCourses(j).getCreditHours() +"\nGrade: "+ year1[i].getCourses(j).getGrade());
            }

        }
    }
}
</code></pre>
