+ 1
What are the differences between these two declarations?
List<Integer> L = new ArrayList<>(); ArrayList<Integer> AL = new ArrayList<>(); In what way they are different OR are they same?
5 ответов
+ 3
I agree with your answer, but as I saw in many collections tutorials they use the List instead of ArrayList as a reference object thats why it bothered me ask this question.
Thanks for the answer
+ 1
https://stackoverflow.com/questions/147468/why-should-the-interface-for-a-java-class-be-preferred
Look for the suggested answer in the above link, I found this as much more detailed explanation.
+ 1
https://www.javaworld.com/article/2073649/why-extends-is-evil.html
This blog post explains why interfaces are more important than Classes.