Conditional statements (if statement)
Conditional statements (if statement)
(IF STATEMENTS)
The boolean Type and Operators
Simple if statement
if-else statement
nested-if statement
Com
plica
te d
if and if...else
7
if i > 0 { if (i > 0) {
System.out.println("i is positive"); System.out.println("i is positive");
} }
(a) Wrong (b) Correct
if (i > 0) { if (i > 0)
System.out.println("i is positive"); Equivalent System.out.println("i is positive");
}
(a) (b)
10
Two-Way Selection
11
AND (&&)
OR(||)