Question: It may be asked somewhere but I could not find it.

Please tell me the exact difference between:

```
ArrayList list = new ArrayList();

```

and

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

```

I cannot figure out what is the exact difference between these two.

Thanks...

Answer: 
```
ArrayList list = new ArrayList();

```

This the non-parameterized container that predates java generics. Objects read out of it usually have to be cast to get what you want.

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

```

Here we we specified that the container holds String objects. No casting is needed to read out.

The 

```
<?>

```

is a wildcard parameter meaning "something" such as String, Integer etc.  

Note that `ArrayList<?> list = new ArrayList()` is invalid syntax; normally the wildcard would be used on method parameters etc.
ArrayList < ? > means array list of type unknown. it is called a wildcard type.

Using the wild card, the following occurs

```
Collection<?> c = new ArrayList<String>();
c.add(new Object()); // Compile time error

```

Without the wildcard you can add whatever you like to your array