title: How can I add new elements to object of ArrayList that I took from newInstance() method?
body: <pre><code>import java.util.*;
  public class Main {
      public static void main(String[] args) {
  
      List list1 = new ArrayList();
           list1.add(1);
           list1.add(2);
           list1.add(3);
  
          Class myClass = list1.getClass();
          Object list2 = myClass.newInstance(); //I want to create the same object like list1
  
          System.out.println(list1.getClass()); //result: class java.util.ArrayList
          System.out.println(list2.getClass()); //result: class java.util.ArrayList
  
  }
  }
  </code></pre>
  
  <p>How can I add some elements to list2 object,
  like I did that with list1 object. FOR EXAMPLE: list2.add(4);  </p>