首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

why can inner class be instantiated in this way

2012-10-29 
why can inner class be instantiated in this way?public class Outer {public void instantiated() {Inn

why can inner class be instantiated in this way?

public class Outer {    public void instantiated() {        Inner in = new Inner();    }    class Inner {        public void a() {        }    }}

?

class Inner can be instantiated in instance method, cuz before new Inner() is called, there must be an outer class instance existing, and if the method instantiated is static, it's not assured.

热点排行