Please enable JavaScript to use CodeHS

CodeHS Glossary

readBoolean Java

Java method that lets us read in a true or false value input from the user. For example in this program: ``` boolean userLikesPizza = readBoolean("Do you like pizza: "); System.out.println("You like pizza: " + userLikesPizza); ``` If the user inputs true, the output will be: ``` You like pizza: true ``` Note: readBoolean will only accept true or false as an answer from the user. If the user answers anything else, the user will be reprompted to try again.