class C extends Object { //no errors in this foo method Object foo(Object o) { C2 v2; v2 = new C2(); //no error, returns the new v2 of type C2 } } class C2 extends C { //error in this foo method: // a superclass has a method with the same name but // different return type C2 foo(Object o) { C2 v; v = new C2(); } } main { 0; }