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

📄 testiface2.java

📁 使用Swing编写的记事本
💻 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 + -