@OP: when Sun decided to introduce 'generics' they also decided that some
objects should be part of it: e.g. their Collection framework. This simply implies
that you don't just have an Arraylist anymore, you have an ArrayList that contains
a certain type, even if the type is just an Object. If you don't specify a type for
the objects to be stored in the ArrayList, all the compiler can do is whine at you.
Just because of backwards compatibility it has to accept that you want to store
just an object (or a derivative thereof) in your ArrayList, but it whines at you.
That's what you saw and you have two options:
1) ignore it and go on programming 'old style' which is semantically valid;
2) agnowledge the fact that you're just storing T type objects in an ArrayList.
For 2) you have to specify the type T using that funny <...> notation and you
have to fill in the dots as in:
-
ArrayList<String> myList= new ArrayList<String>();
-
It's all about static type checking where the compiler is boss ...
kind regards,
Jos