Today we learnt about control statement. The control statements are if else using this we did a program
my program is:
class sasi{
public static void main(String args[]){
int x=10;
int y=5;
if(x>y)
{
System.out.println(“true”);
}
else
{
System.out.println(“false”);
}
}
}
Java compiler executes the code from top to bottom. The statements in the code are executed according to the order in which they appear. However, Java provides statements that can be used to control the flow of Java code. Such statements are called control flow statements. It is one of the fundamental features of Java, which provides a smooth flow of program.
If statement:
The Java if statement is the most simple decision-making statement. It is used to decide whether a certain statement or block of statements will be executed or not i.e if a certain condition is true then a block of statement is executed otherwise not.
else statement:
The ELSE statement specifies that alternate processing is to take place when the conditions of the matching IF statement are not satisfied. ELSE. The ELSE statement has no parameters. The ELSE statement must be column-aligned with the matching IF statement.