黑马程序员技术交流社区

标题: 看看大家对匿名内部类还记得多少 [打印本页]

作者: 嘎路的米    时间: 2015-6-9 21:03
标题: 看看大家对匿名内部类还记得多少
  1. /*
  2.   第一题:用匿名内部类补充如下代码
  3. */
  4. interface Inter{
  5.         void method();
  6. }
  7. public class Demo {
  8.        
  9.         public static void main(String[] args) {
  10.                 show();
  11.         }
  12.         public static void show(Inter i){       
  13.                 i.method();
  14.         }
  15. }
复制代码

  1. /*
  2. 第二题:补足代码
  3. */
  4. interface Text{
  5.         public void func();
  6. }
  7. public class Demo {
  8.         public static void main(String[] args) {
  9.                 //补足代码(匿名内部类)
  10.                


  11.         }
  12.         public void show(Text t){
  13.                 t.func();
  14.         }
  15. }
复制代码


作者: 银哥    时间: 2015-6-9 22:03
刚刚复习了




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2