Subclasses of generic types in Java -


when have example interface drivable , class car implements interface. if make class generic type garage<t extends drivable>, possible make new garage<car> or inheritance not work generic types , should garage<drivable>?

the answer depends on types of drivable want put garage' if want able put type of drivable garage, declare garage<drivable>. if ever want particular instance contain car instances it's acceptable declare garage<car>.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -