the method printDetails its prints out yes if the airCon field airCon is true,But I think this is not the perfect way of doing it, so is there any other way of doing it?
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);
}
}