The if Statement
In this lesson, we’ll explore a statement that alters the sequential execution of the statements in a Java program.
We'll cover the following
Flow of control
The first Java statement that executes in an application program is the first one in the method main
. Subsequent statements execute sequentially unless a statement alters this order. The order in which statements in a Java program execute is called the flow of control. If a statement contains a call to another method, control is given to that method, as shown in the figure given below. Eventually, that method returns control to the method that called it. Execution ends when and if the closing brace in main
is reached. (Realize that other ways of ending program execution are also possible.)
Get hands-on with 1400+ tech skills courses.