I am programming in Java, and I came across the following exception...
"No enclosing instance of type Host is accessible. Must qualify the allocation with an enclosing instance of type Host (e.g. x.new A() where x is an instance of Host)."
Here is the relevant code. Any anyone tell what is causing this exception?
//Creating john
Employee john =new Employee(Name,Address,Age,Salary);
//closing the scanner
in.close();
john.info();
}
class Employee
{
//variables
private String name ="";
private String address="";
private double salary=0.0;
private int age=0;
//constructor
public Employee(String n, String add,int a, double s )
{
name = n;
address = add;
salary = s;
age = a;
}
public void info()
{
System.out.println(name);
System.out.println(address);
System.out.println(age);
System.out.println(salary);
}