📄 testiface2.java
字号:
interface Callback{
void callback(int param);
}
class Client implements Callback{
public void callback(int p){
System.out.println("callback called with"+p);
}
void nonIfaceMeth(){
System.out.println("Classes that implement interfaces "+"may also define other members,too.");
}
}
class AnotherClient implements Callback{
public void callback(int p){
System.out.println("Another version of callback");
System.out.println("p squared is "+(p*p));
}
}
class TestIface2{
public static void main(String args[]){
Callback c=new Client();
AnotherClient ob=new AnotherClient();
c.callback(42);
c=ob;
c.callback(42);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -