// generics/PlainGenericInheritance.java // (c)2016 MindView LLC: see Copyright.txt // We make no guarantees that this code is fit for any purpose. // Visit http://mindviewinc.com/Books/OnJava/ for more book information. class GenericSetter { // Not self-bounded void set(T arg) { System.out.println("GenericSetter.set(Base)"); } } class DerivedGS extends GenericSetter { void set(Derived derived) { System.out.println("DerivedGS.set(Derived)"); } } public class PlainGenericInheritance { public static void main(String[] args) { Base base = new Base(); Derived derived = new Derived(); DerivedGS dgs = new DerivedGS(); dgs.set(derived); dgs.set(base); // Overloaded, not overridden! } } /* Output: DerivedGS.set(Derived) GenericSetter.set(Base) */