public class constructor {
class Person {
private String name;
private String birthday;
private String sex;
public Person( String name, String birthday, String sex) {
this.name = name;
this.birthday = birthday;
this.sex = sex;
}
}
public static void main(String[] args) {
Person obj=new Person("safwan","01--05-1999","male");
}
}
Exception in thread "main" java.lang.Error: Unresolved compilation problem: No enclosing instance of type constructor is accessible. Must qualify the allocation with an enclosing instance of type constructor (e.g. x.new A() where x is an instance of constructor).
at constructor.main(constructor.java:18)