How can i create a instance of the following Class and access its methods. Example:
public class A {
public static class B {
public static class C {
public static class D {
public static class E {
public void methodA() {}
public void methodB(){}
}
}
}
}
}
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 A.B.C.D.E;, so if your class is in another packager then you can call your class using name_of_package.A.B.C.D.E 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();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With