如果airCon字段airCon为真,方法printDetails它的打印结果是yes,但我认为这不是完美的方法,那么还有其他方法吗?
public class Auto
{
private boolean airCon;
public Auto() {}
public void setAirCon(boolean airCon) {
this.airCon = airCon;
}
public void printDetails() {
String con;
if(airCon) {
con = "Yes";
} else {
con = "No";
}
System.out.println(con);
}
}