5.9. Review notes
if and if-else constructs:
- The if statement enables you to execute a set of statements in your code based on the result of a condition, which should evaluate to a boolean or a Boolean value.
- The multiple flavors of an if statement are if, if-else, and if-else-if-else.
- The if construct doesn’t use the keyword then to define code to execute when an if condition evaluates to true. The then part of the if construct follows the if condition.
- An if construct may or may not define its else part.
- The else part of an if construct can’t exist without the definition of its then part.
- It’s easy to get confused with the common if-else syntax used in other programming languages. The if-elsif and if-elseif statements aren’t used in Java ...
Get OCA Java SE 8 Programmer I Certification Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.