I am try to find out why below code is giving error, Can anybody explain please. Here is a class
package abc;
public class A {
public class B {
}
}
Now I am try to create a B class
package xyz;
import abc.*;
public class B extends A{
public static void main(String[] args) {
B b = new B (); // this line gives error. Can you please explain
}
}
Please consider class B extends A is in default package means
import abc.*;
public class B extends A{
public static void main(String[] args) {
B b = new B (); // this line gives error. Can you please explain
// I am try to create "B" class object which extends A
//.. not the B inner class
}
}
Error shows in eclipse is : "No enclosing instance of type A is accessible. Must qualify the allocation with an enclosing instance of type A (e.g. x.new A() where x is an instance of A)."