ITM 200 Chapter Notes - Chapter 5: Boolean Expression

30 views3 pages

Document Summary

Boolean expression is one which evaluates to a boolean value. The if statement decides whether a section of codes executes or not. The if statement used a boolean to decide whether the next statement of blocks of statements executes. There are only two possible values for boolean expressions: You can construct simple boolean expressions from the relational operators which are below. Syntax of the java if-else statement is as below: If and else are java reserved words, which give the if-else statement its structure and tell the complier that this is an if-else statement. The and are java statements. Curly braces use is not required if there is only one statement to be conditionally executed. Sometimes curly braces can help make the program more readable. Indentation makes it much easier to match up else statements with their corresponding if statement.