What is the difference between these two collection : | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between these two collection :

ArrayList<String> ls= new ArrayList<String>() ; List<String> ls= new ArrayList<String>(); I know that List is interface but how these statement will work!

11th May 2022, 4:56 AM
Rgodella
Rgodella - avatar
1 Answer
0
If you use the List interface, than you are be able to change your variable from ArrayList, to LinkedList example
11th May 2022, 5:09 AM
Domonkos Gyömörey
Domonkos Gyömörey - avatar