Boolean Expressions: true or false

Here is an example of how to ask a True False question in a quiz.



Download this project

public void myFirstMethod() {
    Boolean answer = this.alien.getBooleanFromUser( "The planet Earth has just one moon." );
    if( answer ) {
        this.alien.say( "Yep, just one." );
    } else {
        this.alien.say( "It is true! Can you imagine?? Just one moon!!" );
    }
} 

NEXT: A drill on Boolean values