title: How can I store String objects in a Java ArrayList
body: <p>I am new in java. I just want that how can I store String objects(Variables) in an arraylist in java.</p>
  
  <p>Here is my sample code :</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  
  public class Test_Class {
      String first="hello";
      String second="bye";
  
      List&lt;String&gt; myArray = new ArrayList&lt;String&gt;();
      myArray.add(first);
      myArrray.add(second);
  }
  </code></pre>
  
  <p>But this code is not working for me. Please suggest me where I am doing wrong.
  Thanks.</p>