- abstract class AbsDemo{
- abstract void show();
- }
- class Outer{
- int x = 3 ;
- public void function(){
- new AbsDemo(){
- void show(){
- System.out.println("inner"+x);
- }
- }.show();//.show()怎么理解,前面一大堆是个对象吗?//是的话有怎么理解
- }
- }
- class NoNameInnerClassDemo{
- public static void main(String[] args) {
- new Outer().function();
- }
- }
复制代码 |