title: Static ArrayList being empty when called from another class
body: <p>In classC I read from a csv file and put them into classA object and then to arraylist classB which is subclass of class A</p>
  <pre><code>public class classC {
      public static ArrayList&lt;classA&gt; arraylist= new ArrayList&lt;&gt;();
  
      private classC() {
          // do not instantiate
      }
  
      public static ArrayList&lt;classA&gt; readData(File inFile) {
          try {
              Scanner reader = new Scanner(inFile);
              String header = reader.nextLine();
              
              while (reader.hasNextLine()) {
                  String nextLine = reader.nextLine();
  
                  //System.out.println(nextLine);
                  
                  String[] tokens = nextLine.split(&quot;,&quot;);
                  String a= tokens[0];
                  double b= Double.parseDouble(tokens[1]);
                  double c= Double.parseDouble(tokens[2]);
                  double d= Double.parseDouble(tokens[3]);
                  double e=Double.parseDouble(tokens[4]);
  
                  //store the data in classa object
                  classA classa= new classA(a, b, c, d, e);
  
                  //store each object in an arraylist
                  arraylist.add(classa);
              }
  
              for (int i = 0; i &lt; arraylist.size(); i++) {   //these prints fine
                  System.out.println(arraylist.get(i) + &quot; &quot;);
              }
  
              System.out.println(arraylist.size());
  
              return arrayList;
      }
  }
  </code></pre>
  <p>then in Class B I try to print the array but the arraylist is empty</p>
  <pre><code>public class classB extends ArrayList&lt;classA&gt; {
      public static ArrayList&lt;classA&gt; arraylist = new ArrayList&lt;&gt;();
  
      public classB() {
      }
  
      //here is my method to print
      public void printArray() {
          System.out.println(&quot;Elements of ArrayList are:&quot;);
          System.out.println(arraylist.size()); //prints 0
      }
  }
  </code></pre>
  <p>in my main method</p>
  <pre><code>public class Main {
      public static void main(String[] args) {
          File inFile = new File(&quot;file.csv&quot;);
          readData(inFile);
          classB classb = new classB();
          classb.printArray();
      }
  }
  </code></pre>
  <p>in classA i have neccessary getters setters and toString method to print properly, I can print fine from classC readData method but cannot from classB printArray method.</p>
  <p>Can someone tell me what i am doing wrong ?</p>