When using a list, you should always use the interface List for the variable declarations and the result and the input parameters of methods using/returning lists. For example a field containing a list should be declared as:
Listand not asbooks = new ArrayList ();
ArrayListThe reason is information hiding. One wants to hide the information about what implementation class one has used for lists. This allows one later to replace the implementation of ArrayList by another, for a given application, more efficient implementation of list.books = new ArrayList ();