aspose file tools
The moose likes Java in General and the fly likes comparison of List & ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "comparison of List & ArrayList" Watch "comparison of List & ArrayList" New topic

comparison of List & ArrayList

k sabeerdeen

Joined: Mar 11, 2010
Posts: 14
hi experts,

what is the difference between the two :

List list= new ArrayList();

ArrayList list = new ArrayList();

thanks in advace!
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3121

It is something called Coding to the interface.
With the first- We could assign instances of anything which implements List- ArrayList, LinkedList, Vector to the list reference
In the second case- We can assign instances of ArrayList only.

Mohamed Sanaulla | My Blog
subject: comparison of List & ArrayList