List and ArrayList
I understand tat List is an interface and ArrayList is a class that implements the List interface. I am not able to understand the difference bwtween the following two statements:
Thanks in advance.
List myArr = new ArrayList();
ArrayList myArr = new ArrayList();
The general idea of why the first line is recommended over the second is given on this page Lesson: Implementations in the fifth paragraph following the "General-purpose Implementations" table, starting with: "As a rule, you should be thinking about the interfaces, not the implementations.";
Thanks for sharing this. Its helped me.