public class Test {
static class Parent {
public <T> Object foo() { System.out.println("Parent"); return null; };
}
static class Child extends Parent {
@Override
public Object foo() { System.out.println("Child"); return null; };
}
public static void main(String[] args) {
Parent p = new Child();
p.foo(); // output: Child
}
}
the above answer is great, just wanted to add a small addendum that technically, one can remove type parameters in the overriding method. i don't have enough reputation to comment so i'm writing here