Page 91 - Trackpad_ipro 4.1_Class8
P. 91
Program 4: Write a program to print a table with an entered number.
public class Program4
{
public static void main(int number)
{
int i = 1;
System.out.println("The entered number is: "+ number);
System.out.println("Table is:");
do
{
System.out.println(number +" × "+i+ " = "+ number * i);
i++;
}
while (i <= 10);
}
}
Reb t
Conditional statements allow us to change the default flow of a program.
Loop statements are control flow statements that allow us to repeatedly execute a set
of instructions a given number of times.
Java offers two jump statements—break and continue—which are used within the
loops.
An error is an abnormal condition that can stop the execution of a program.
OneOne Touch Learn Section A (Objective)
A. Tick ( ) the correct option.
1. Which of these is not a type of statement in the Java language?
a. if statement b. if … else statement
c. if … else… if statement d. if…elif…if statement
2. Which of the following statements is used to execute either of the blocks of statements
from if or else statements?
a. if…else b. if
c. switch d. while
Conditional, Looping and Jumping Statements in Java 89

