+ 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?

9th Jul 2018, 3:20 PM
movis
movis - avatar
1 Answer
+ 5
https://www.sololearn.com/learn/Java/2164/ Maybe you should read this first.
11th Jul 2018, 9:30 AM
Siddharth Golecha
Siddharth Golecha - avatar