+ 2
Object creation in java
I am facing this error "Exception in thread "main" java.lang.Error:Unresolved compilation problem: No enclosing instance of type Arsh is acessible. Must qualify the allocation with an enclosing instance of type Arsh(e.g. x.new A() where x is an instance of Arsh). at Arsh.main(Arsh.java:35)" import java.util.Scanner; public class Arsh{ public class Animal{ private... private... getter setter public static void main(String[]args){ int ch; Animal dog=new Animal();(error here) Animal cat=new Animal();
2 Antworten
+ 2
it says in problem view
No enclosing instance of type Arsh is acessible. Must qualify the allocation with an enclosing instance of type Arsh(e.g. x.new A() where x is an instance of Arsh). at Arsh.main(Arsh.java:35)
0
You havea compilation failure because of this problem. You should see a compilation error showing in the Problems view that needs fixing.