Question: ```
ArrayList<yellowPage> ob1 = new ArrayList<yellowPage>(); 
yellowPage thing = new yellowPage(100,100);
thing.calc(i,y,s3); 
ob1.add(thing);

```

I stored some data in `thing`. How can I retrieve the value stored in `ob1.thing`?

Answer: 
```
int x=5;
int info=ob1.get(x).getInfo();

```

The above example will get whatever information you wanted from your yellow pages class (by using a getter method) at the 6th index (because 0 counts) of your array list ob1. This example assumes you want an integer from the yellow page. You will have to create a getter method and change the x to the index of the yellow page you want to retrieve information from.

An example getter method (which you should put in your yellow pages class) could look like this:

```
public int getInfo() { return z; }

```

In the above case z may be an instance variable in your yellow pages class, containing the information you're looking for. You will most probably have to change this to suit your own situation.

If you wanted to get information from all yellow pages stored in the array list then you will need to iterate through it as Chrandra Sekhar suggested
```
Class ArrayList<E>

```

Syntax

```
ArrayList<Integer> list = new ArrayList<Integer>();

```

You replace "Integer" with the class that the list is of.
An application can increase the capacity of an ArrayList instance before adding a large number of elements using the ensureCapacity operation. This may reduce the amount of incremental reallocation.
E represents an Element, which could be any class.
`ensureCapacity` is used to ensure that the list has enough capacity to take in the new elements. It's called internally every time you add a new item to the list. As the name suggests, `ArrayList` uses an Array to store the items. So when the array is initialized, it's given an arbitrary length, say 10. Now once you've added 10 items, if you go to add the 11th item, it'll crash because it exceeds the arrays capacity. Hence, `ensureCapacity` is called (internally) to ensure that there's enough space. So if you were adding the 11th element, the array size might be, say, doubled, to 20.