标签:blog ar java div log as new tt class
package mypack; public class Outer { Inner1 w = new Inner1(); /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Outer demo = new Outer(); //创建内部类,要先把外部类实例化,然后实例化内部类 Outer.Inner1 Inner1 = demo.new Inner1(); //创建静态内部类,可以直接实例化 Outer.Inner2 Inner2 = new Outer.Inner2(); } //非静态内部类 class Inner1{ Inner1(){ } int a = 0; } //静态内部类 static class Inner2{ Inner2(){ } int a = 0; } }
标签:blog ar java div log as new tt class
原文地址:http://www.cnblogs.com/wikiki/p/4127692.html