I am very new to java, and I am trying to get my method to return "yes" or "no" depending on whether another method returns True or False. My code below:
public String toString () {
return "The number of cars currently in the queue is : " + numberOfCars ;
if(isFull()) {
return "yes";
} else {
return"no";
}
When I run this, I get an error: unreachable statement. What is cauing this?
Aucun commentaire:
Enregistrer un commentaire