ArrayList aList = new ArrayList(); List aList = new ArrayList();
What\'s the difference between these two and which is better to use and why?
I prefer the second in most cases because it signifies that you're not using anything specific in the ArrayList api, and if you need to later you can substitute any other type of List without having to change any code except the first line.