inheritance - Declaring a superclass variable then instantiating it with a subclass in Java -
this question has answer here:
- what mean “program interface”? 29 answers
i little confused , looking clarification on differences , different benefits 2 different approaches declaration , instantiation of map.
what difference between
map<string, string> mymap = new hashmap<string, string>;
and
hashmap<string, string> mymap = new hashmap<string, string>;
what benefit or reason declaring superclass variable instantiating subclass?
this called "programming interface". (map
interface, not class.) allows code needs map
operations not care kind of map
is.
you switch out hashmap
for, say, treemap
if feel it's appropriate, , no other code change.
other similar questions:
other references:
Comments
Post a Comment