The first declaration adheres to the generally accepted principle that you shouldUse Interface References to Collections. You should do this in case you decide later to change to a different kind of List. In that case you'd be guaranteed to only have to change one line of code, your List declaration.
The second declaration is okay if you know that you'll only ever use an ArrayList, but why limit yourself? You might later find out that a LinkedList has better performance characteristics for your particular application. If that happened you'd have to look everywhere in your code that you used an ArrayList reference and see what the change might impact.
Thanks for your reply. I have one more question. Say, if I use this, List list = new ArrayList() do I have to look at the List's methods or ArrayList's methods in the API? Whose methods will I be invoking with the reference variable list?
If you declare your list as List list = new ArrayList();, then when dealing with your list reference, you'd need to use the List interface. This is not a bad thing! This protects you from using ArrayList-specific methods, which would make it difficult to change your mind later and use a LinkedList.
He puts the "turd" in "saturday". Speaking of which, have you smelled this tiny ad?