调用构造函数时找不到符号

时间:2018-09-10 19:07:20

标签: java jcreator

当我尝试运行此代码时:

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

    }
}

我收到一条错误消息,提示“错误:找不到符号”

我要运行的Employee类代码:

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;
    }

Employee类为后缀中的所有变量提供了各种设置方法和获取方法。

1 个答案:

答案 0 :(得分:-1)

我建议您打开项目设置并重新创建源代码文件夹-定义src目录,以便intellij可以识别。 另请参见this