Java: How to create inner class object directly

package thinking.learnInternalClass.hengbao;

public class DotNew {
    public class Inner{

    }
    public static void main(String[] args) {
        DotNew dn=new DotNew();
        DotNew.Inner dni=dn.new Inner();
    }
}
/ /To directly create an object of the inner class, you can't refer to the name of the outer class DotNew as imagined, but must use the object of the outer class to create the inner class object, as seen in the above program.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327060114&siteId=291194637