• Post Reply Bookmark Topic Watch Topic
  • New Topic

comparison of List & ArrayList  RSS feed

 
k sabeerdeen
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi experts,

what is the difference between the two :

List list= new ArrayList();

ArrayList list = new ArrayList();

thanks in advace!
 
Mohamed Sanaulla
Bartender
Posts: 3184
34
Google App Engine Java Ruby
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!