Java Reference
In-Depth Information
Control Statements
There three types of statements in java.
Selection statements
Iteration statements
Jump statements
Selection statements
It is to manage the flow of programs that is to be executed based on the dy-
namic conditions which can be only realized during the run time.
It provides flexibility.
If statement- It provides different paths for execution of program.
If (condition provided) statement a;
Statement b;
This means if the condition is true, then statement a is executed but if false then statement b
is executed.
For example
int a, b;
If (x < y) a=0;
Now there is one type of procedure using if statement i.e. nested if statement and it is very
common method in programming world.
For example
If (a == 10) {
If (b < 15) i = j;
If (c > 50) p = q;
Search WWH ::

Custom Search