toString当我运行代码时,方法没有显示任何内容:
public abstract class Employee {
private String firstName, lastname, socialSecurityNumber;
Employee(){
System.out.println("Employee Constructor called");
firstName="Tony";
lastname="Stark";
socialSecurityNumber="3000";
}
public String getFirstName(){
System.out.println(firstName);
return firstName;
}
public String getLastname(){
return lastname;
}
public String getSocialSecurityNumber(){
return socialSecurityNumber;
}
public String toString(){
getSocialSecurityNumber();
getLastname();
getFirstName();
return null;
}
}
//Main method:
public void ComissionEmployeeTest(){
Employee checkFirstly=new ComissionEmloyee();
checkFirstly.toString();
}
紫衣仙女
DIEA
慕姐4208626
相关分类