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.