- /*
- 第一题:用匿名内部类补充如下代码
- */
- interface Inter{
- void method();
- }
- public class Demo {
-
- public static void main(String[] args) {
- show();
- }
- public static void show(Inter i){
- i.method();
- }
- }
复制代码
- /*
- 第二题:补足代码
- */
- interface Text{
- public void func();
- }
- public class Demo {
- public static void main(String[] args) {
- //补足代码(匿名内部类)
-
- }
- public void show(Text t){
- t.func();
- }
- }
复制代码
|
|