can't set a value in another class : <p>This is a method from a class, courses is an array from another class, I set the value of cn in main, but it skips all the codes after it. Why is that?</p>

<pre><code>public class GradeBook {
    Scanner r=new Scanner(System.in);
    private int cn;
    private Course courses[]=new Course[cn];
    void entercourse(){
         for(int i = 0;i&lt;courses.length;i++){
             System.out.println("c name");
             courses[i].setName(r.nextLine());
             System.out.println("mark");
             courses[i].setMark(r.nextInt());
             courses[i].setpass();
         }
    }
</code></pre>
