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 -

What is the difference between data design and data model(ERD) -

ios - Can NSManagedObject conform to NSCoding -