package Demo10;
import java.applet.Applet;
public class Test {
public static void main(String[] args) {
//没有名字初始化类,不用将实例保存到变量中
new Apple().eat();
new Uservice(){
@Override
public void hello() {
}
};
}
}
class Apple{
public void eat(){
System.out.println("1");
}
}
interface Uservice{
void hello();
}
import Demo10.Outer;
public class Application {
public static void main(String[] args) {
//外部类 new
Outer outer = new Outer();
//通过这个外部类来实例化内部类
Outer.Inner inner = outer.new Inner();
inner.getID();
}
}
标签:Outer,内部,void,public,static,new,class From: https://www.cnblogs.com/anonymity12/p/18187579