⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calldemo.java

📁 it is a good tool to help you study java
💻 JAVA
字号:
interface Callback{
void callback(int paran);
}
class Client implements Callback{
//实现接口中的方法
public void callback(int p){
System.out.println("Callback called with"+p);
}
//实现接口的类中另外定义的方法
void nonIfaceMeth(){
System.out.println("Classes that implement interface"+
"may also define menbers 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);
}
}

public class callDemo{
public static void main(String args[]){
Client c=new Client();
c.callback(20);
c.nonIfaceMeth();
AnotherClient anc=new AnotherClient();
anc.callback(54);
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -