I am trying to understand what is the difference between the below 2 lines of code.
I know for a reason that one is of the reference type List
and the other of the reference type ArrayList
. But does it really matter or is it just 2 different ways of doing the same thing ?
Its not only with these classes/interface but with others as well. I believe it is a Polymorphism feature of an object taking different forms is that correct ?
List a1 = new ArrayList();
ArrayList a1 = new ArrayList();