?? ex21.java
字號:
// innerclasses/Ex21.java
// TIJ4 Chapter Innerclasses, Exercise 21, page 367
/* Create an interface that contains a nested class that has a static method that
* calls the methods of your interface and displays the results. Implement your
* interface and pass an instance of your implementation to the method.
*/
interface In {
String f();
String g();
class Nested {
static void testIn(In i) {
System.out.println(i.f() + i.g());
}
}
}
public class Ex21 implements In {
public String f() { return "hello "; }
public String g() { return "friend"; }
public static void main(String[] args) {
Ex21 x = new Ex21();
In.Nested.testIn(x);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -