title: How to use an array list in Java?
body: <p>I need to know if I store my data in an ArrayList and I need to get the value that I've stored in it.</p>
  
  <p>For example : if I have an array list like this </p>
  
  <pre><code>      ArrayList A = new ArrayList();
        A = {"Soad", "mahran"};
  </code></pre>
  
  <p>and I want to get each String element, how can I do it?</p>
  
  <p>I've tried to do it by the following code:</p>
  
  <pre><code>package arraylist;
  
  import java.util.ArrayList;
  
  public class Main {
  
          public static void main(String[] args) {
          ArrayList S = new ArrayList();
  
          String A = "soad ";
          S.add(A);
          S.add("A");
          String F = S.toString();
          System.out.println(F);
          String [] W = F.split(",");
          for(int i=0 ; i&lt;W.length ; i++) {
             System.out.println(W[i]);
          }
      }
  }
  </code></pre>