Quantcast
Channel: Why the coding should be "to the interface" especially for primitive datatypes? - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Why the coding should be "to the interface" especially for primitive datatypes?

$
0
0

I have a doubt on the design methodology that why we implement the code to the interface. This is very much observed in primitive data types. Like I am not getting the difference between these two :

Map<Integer, String> mymap = new HashMap<Integer, String>(); 

And

HashMap<Integer, String> mymap = new HashMap<Integer, String>();

Is there any difference between these two? I mean each and every place where we are going to use mymap will remain same in both the cases.

I am sorry if the question seems to be of no use but I really not getting that how this is going to make any difference later on where mymap will be used. Please help?

Thanks..

Note - I have already seen this question on SO but it is not giving what I want.


Viewing all articles
Browse latest Browse all 7

Trending Articles