I am pretty new to Java and I wanted to know what this actually means:
List<Integer> list = new ArrayList<Integer>(); //Example 1
To distinguish this question from others, I've read the posts about polymorphism and the difference between Example 1 and Example 2, and I understand that Example 1 allows for "programming to interface." I also understand that with Example 1, list can easily be changed to LinkedList without affecting the rest of the code.
ArrayList<Integer> list = new ArrayList<Integer>(); //Example 2
But what I want to know what Example 1 actually means. Does it create a new List? Or does it create a new ArrayList? Does the resulting object have the properties of a List? Or does the resulting object have the properties of an ArrayList? Could I implement methods that an ArrayList uses on list without a compile error?
This is my first time posting a question, so please let me know if I can make any improvements.