A
Alper
Hello people,
I start programming with java 2 months ago and it goes pretty well for
now. I was exploring the Collections Interface and I have a question
about it.
Why would u use this line;
List list = new ArrayList();
Instead of this one;
ArrayList alist = new ArrayList();
I know that in the first one, we create a list reference variable and
assigned it to the new ArrayList instance and I know that I can only
use the methods of list but not arraylist. but why would i need List
reference while i can use ArrayList reference? I mean what's the
benefit of using List reference or Collection Reference when creating
an ArrayList Instance?
Thx for ur help
I start programming with java 2 months ago and it goes pretty well for
now. I was exploring the Collections Interface and I have a question
about it.
Why would u use this line;
List list = new ArrayList();
Instead of this one;
ArrayList alist = new ArrayList();
I know that in the first one, we create a list reference variable and
assigned it to the new ArrayList instance and I know that I can only
use the methods of list but not arraylist. but why would i need List
reference while i can use ArrayList reference? I mean what's the
benefit of using List reference or Collection Reference when creating
an ArrayList Instance?
Thx for ur help