interface I { String getValue(); } interface J extends I { } class X implements I { public String getValue() {return "X";} } class Y implements J { public String getValue() {return "Y";} } class Test { void foo(I i) { if (!(i instanceof J)) return; String s = i.getValue(); } }