public interface TwoMethodInterface {
void method1();
void method2();
}
public class ChildTwoMethodInterface implements TwoMethodInterface {
public void method1(){
System.out.println("ChildTwoMethodInterface:method1");
}
public void method2(){
System.out.println("ChildTwoMethodInterface:method2");
}
public void method3(){
System.out.println("ChildTwoMethodInterface:method3");
}
}
public class ChildTwoMethodTest {
public static <T extends TwoMethodInterface> void genericMethod(T t){
t.method1();
}
public static void main(String[] args) {
TwoMethodInterface childTwoMethodInterface = new ChildTwoMethodInterface();
genericMethod(childTwoMethodInterface);
}
}