Difference:
- First one, Only methods of the interface
List
can be invoked on the list object. polymorphisme is present here.
- Second one, methods of
ArrayList
class can be invoked on the list object.
Advantages of the first one:
Even if you change the implementation to:
List<String> list = new LinkedList<String>();
or
List<String> list = new Vector<String>();
You have not to change the rest your code.