Chris
Chris

Reputation: 19

Cannot find symbol when calling constructor

When I try to run this code:

public class Main
{
    public static void main(String[] args) 
    {
        Employee employee1 = new Employee("John", 5545, "R&D", "QA Lead", 50000);

    }
}

I get an error saying "error: cannot find symbol"

The Employee class code I'm trying to run:

public class Employee 
{

    private int ID;
    private double salary;
    private String name, department, designation;

    public Employee(){}

    public Employee(String userName, int userID, String userDepartment, String userDesignation, double userSalary)
    {
        name = userName;
        ID = userID;
        department = userDepartment;
        designation = userDesignation;
        salary = userSalary;
    }

The Employee class has various setters and getters for all the variables afterwords.

Upvotes: 0

Views: 69

Answers (1)

Adam Ostrožlík
Adam Ostrožlík

Reputation: 1416

I suggest you to open your project settings and recreate folders for source code - define src directory so intellij can recognize. See also this

Upvotes: -1

Related Questions