So i have recently started learning java and currently studying Array List. 

Suppose that i have two classes A and B. In class A i have two attributes which are string type 'name' and int type 'age'.

In class B i have an array list and what i want to do is add the value of name and age in the array list.

How can i do that and also how can i add different type of data in one Array list ?
Following is the code in the two classes that i have written but compiler gives error.

```
public class A {

    public String name;
    public int age;

    public input()
    {
        name = "ALI";
        age = 20;
    }

}  

public class B{

    A obj = new A();
    ArrayList aa = new ArrayList(); //error here

     aa.add(obj.name); //error here

}

```