我正在尝试在我的应用程序的主要方法中创建员工类的对象,但它找不到变量部门姓氏名字或薪水,我不确定为什么这是我的陈述的样子
Employee employee = new Employee( department, lastName, firstName, salary);
员工类看起来像
package javaapplication14;
public class Employee implements DepartmentConstants, Displayable
{
private int department;
private String firstName;
private String lastName;
private double salary;
public Employee(int department, String lastName, String firstName,
double salary)
{
this.department = department;
this.lastName = lastName;
this.firstName = firstName;
this.salary = salary;
}
@Override
public String getDisplayText()
{
String displayText = firstName + lastName + salary + department ;
return displayText;
}
}
我不确定是否需要展示其实现的接口,但如果需要,我将编辑我的帖子以包含它们。主要方法是
package javaapplication14;
public class DisplayableTestApp
{
public static void main(String args[])
{
System.out.println("Welcome to the Displayable Test application\n");
// create an Employee object
Employee employee = new Employee( department, lastName, firstName, salary);
// display the employee information
String displayTextEmployee = employee.getDisplayText();
System.out.println(displayTextEmployee);
// create a Product object
Product product = new Product();
// display the product information
String displayText = product.getDisplayText();
System.out.println(displayText);
}
}