public class Demo {
public static void main(String[] args) {
test(new Print() {
@Override
public void print(String str) {
PrintObj.renamePrint(str);
}
}, "test");
}
public static void test(Print print, String s) {
print.print(s);
}
public static class PrintObj {
public static void renamePrint(String str) {
System.out.println(str);
}
}
public static interface Print {
void print(String str);
}
} |