Java 中有些类的定义中包含第一个类的定义 这种处于内部的类称为内部类
Public class OuterClass
{
public class InnerClass
{
//-----This is a Inner Class
}
}
Public class OuterClass
{
public class InnerClass
{
//-----This is a Inner Class
}
}
Public class Test
{
public static void main(String[] args)
{
OuterClass out = new OuterClass();
OuterClass.InnerClass in = out.new InnerClass();
//--Replaced by-- OuterClass.InnerClass in = new OuterClass().new InnerClass();
}
}