title: How to fix this NullPointerException when pushing static objects?
body: <p>I made it before and it worked, now it throws NullPointerException when create new student or do pushStudents()</p>
  <pre><code>public class Student {
      private String name;
      private char sex;
      private int age;
      private int course;
      private double avgGrade;
      public static ArrayList&lt;Student&gt; students;
  
      public Student(String name, char sex, int age, int course, double avgGrade) {
          this.name = name;
          this.sex = sex;
          this.age = age;
          this.course = course;
          this.avgGrade = avgGrade;
          students.add(this);
      }
  
      public static void pushStudents () {
          students.add(new Student(&quot;Olaf&quot;, 'm', 25, 4, 8.5));
          students.add(new Student(&quot;Alisa&quot;, 'f', 23, 3, 7.2));
          students.add(new Student(&quot;Ryze&quot;, 'm', 21, 2, 3.8));
          students.add(new Student(&quot;Kate&quot;, 'f', 28, 5, 5.1));
          students.add(new Student(&quot;Mike&quot;, 'm', 24, 1, 7.3));
          students.add(new Student(&quot;Quyana&quot;, 'f', 29, 3, 9.8));
          students.add(new Student(&quot;Soraka&quot;, 'f', 18, 4, 6.9));
          students.add(new Student(&quot;Blitz&quot;, 'm', 22, 2, 8.4));
      }}
  </code></pre>