+ 1
Why declare a variable its parent?
I find somebody writing their codes like: Map<String, Integer> map = new Hashmap<>(); List<String> list = new ArrayList<>(); instead of: Hashmap<String, Integer> map = new Hashmap<>(); ArrayList<String> list = new ArrayList<>(); So is there any advantages? Or it's just their habit?
1 Answer
+ 5
https://www.sololearn.com/learn/Java/2164/
Maybe you should read this first.