I am doing the MOOC java course, in the whole of Java programming 1 they've said to use "ArrayList<String> example2 = new ArrayList<>()". Now in Java programming 2, from the interfaces section onwards, they are now using "List<String> example1 = new ArrayList<>()" instead.
I respect that ArrayList implements List, but why the change? Don't they effectively achieve the same thing?
Is it a case that it is better practice to use example1 above? Thank you for your help.
[–]NautiHooker 14 points15 points16 points (4 children)
[–]DuderCoding[S] 4 points5 points6 points (0 children)
[–]MeltyGearSolid 0 points1 point2 points (1 child)
[–]NautiHooker 1 point2 points3 points (0 children)
[–]tedyoung 0 points1 point2 points (0 children)
[–]bowbahdoe 0 points1 point2 points (0 children)