A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© wangmiaosen 中级黑马   /  2015-12-28 09:06  /  731 人查看  /  2 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

这样是拆开的写法,看上去会不会有帮助呢?代码如下:
interface Inter {
        void show();
}
class Outer {
        public static Inter method() {
                class Inner implements Inter{
                        public void show(){
                                System.out.println("HelloWorld2");
                        }
                }

                return new Inner();
        }
}
class Demo {
        public static void main(String[] args) {
                Outer.method().show();
        }
}
赶紧发个帖子,凑够技术分数,后面再发详细的讲解,供大家交流

2 个回复

倒序浏览
这样确实更好理解一些
回复 使用道具 举报
yifuyue 发表于 2015-12-28 15:27
这样确实更好理解一些

最近学的咋样?
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马