Skip to content

Glossary: Java Basics

if statement

Also written: if, else, else if, if/else

Runs a block of code only when its condition is `true`; `else` covers the other case, and `else if` chains more tests. Java runs only the first block whose condition is true.

Where the book teaches it

Related terms

ConditionSwitch expressionBlock