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 list = new LinkedList();
or
List list = new Vector();
You have not to change the rest your code.