zoukankan      html  css  js  c++  java
  • java内部类的调用方式


    public class DotThis {
    public class Inner{
    public DotThis outer(){
    return DotThis.this;
    };
    }
    /*
    1.第一种 必须创建获取内部类的方法
    public Inner inner(){
    return new Inner();
    }*/

    public static void main(String[] args) {
    //DotThis dt = new DotThis();
    //DotThis.Inner dti=dt.inner();

    //2.第二种直接就能获取到
    DotThis dotThis = new DotThis();
    Inner inner = dotThis.new Inner();
    }
    }
  • 相关阅读:
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
  • 原文地址:https://www.cnblogs.com/q1359720840/p/10386106.html
Copyright © 2011-2022 走看看