import java.lang.reflect.Method;
import java.lang.Class;
interface I{
public void hello();
}
class A implements I{
public void hello(){
System.out.println("hello");
}
}
class B{
public void call_hello(I i){
i.hello();
}
}
public class testCase{
public static void main(String[] args) {
try{
String methodName = "call_hello";
B b = new B();
A a = new A();
Class c = B.class;
Class[] parameterTypes = new Class[] {A.class};
Method m = c.getMethod(methodName, parameterTypes);
m.invoke(b, new Object[] {a});
} catch (Exception e){
e.printStackTrace();
}
}
}