concept if statement in category java

appears as: n if statement, if statement
Java SE 11 Programmer I Certification Guide

This is an excerpt from Manning's book Java SE 11 Programmer I Certification Guide.

Let’s redefine variable, avg, local to the if block of an if statement (code that executes when the if condition evaluates to true):

Figure 6.2 Multiple flavors of the if statement: if, if-else, and if-else-if-else

Exam Tip In Java, then isn’t a keyword, so it must not be used with the if statement.

OCA Java SE 8 Programmer I Certification Guide

This is an excerpt from Manning's book OCA Java SE 8 Programmer I Certification Guide.

Let’s define another variable, avg, local to the if block of an if statement (code that executes when the if condition evaluates to true):

Figure 5.1. Multiple flavors of the if statement: if, if-else, and if-else-if-else

Let’s look at a few examples of some of the valid variables and expressions that can be passed to an if statement: