title: How to get a specific element from an arraylist that has string and int values from another class
body: <p>here is my problem.</p>
  
  <p>I have a class A that has a string of names and int of numbers which is placed into an ArrayList of another class. </p>
  
  <p>Task:- what i need to do is get the first name from index(0) from the arraylist and return it as a string.</p>
  
  <pre><code>public class A
    {  
    private String name;
    private int num;
    public A(String aName, int bNum)
    {
      name = aName;
      num = bNum;
    public String getName()
    {return name; }
    public int getNum()
    {return num;}
    }
    } 
  
  //class b inserts elements of class a into arraylist
  public class b
    {
    private ArrayList&lt;A&gt; myList;
    }
    public b()
    myList = new ArrayList&lt;A&gt;;
  
    public void addAll(A all)
    { myList.add(all);}
  
  //get method required for issue above.
  </code></pre>