Page 77 - TP_iPlus_V2.1_Class8
P. 77
Conditional, Looping and
Jump Statements
in Java 5
Learning Outcomes
Conditional Statements Looping Statements
Jump Statements Errors in Java
Writing Some More Programs
The programs we have written till now were executed statement by statement in a top-to-bottom
approach. Sometimes, we need to change the order of execution for statements. We also need
to repeat some statements a certain number of times. Apart from these, some situations occur
when we need to stop the execution of any statement. Java provides three types of statements,
which are as follows:
• Conditional Statements • Looping Statements • Jump Statements
Let us learn about these in detail.
i + CONDITIONAL STATEMENTS
Conditional statements allow us to change the default flow of a program. They transfer control of
a program from one statement to another, depending on the condition provided. If the provided
condition returns true, a block of specified statements is executed. Conditional statements are
also known as decision-making statements.
There are four decision-making statements in Java as follows:
• if statement
• if … else statement
• if … else… if statement
• switch statement
Let‘s learn about these decision-making statements in Java.
The if Statement
The if statement is the most basic conditional statement in Java that allows us to test a condition
before executing a block of statements. If the provided conditional expression returns true, the
statements specified in the body of the if statement are executed.
75
Conditional, Looping and Jump Statements in Java

