Java access static nested class

This question already has an answer here:

  • Java inner class and static nested class 23 answers

  • You can use :

    A.B.C.D.E e = new A.B.C.D.E();//create an instance of class E
    e.methodA();//call methodA 
    e.methodB();//call methodB
    

    Or like @Andreas mention in comment you can use import ABCDE; , so if your class is in another packager then you can call your class using name_of_package.ABCDE like this:

    import com.test.A.B.C.D.E;
    //     ^^^^^^^^------------------------name of package
    
    public class Test {
    
        public static void main(String[] args) {
            E e = new E();
            e.methodA();
            e.methodB();
        }
    }
    
    链接地址: http://www.djcxy.com/p/92020.html

    上一篇: Java内部类(实现单个链接列表)

    下一篇: Java访问静态嵌套类