You are on page 1of 3

CHILDREN’S ACADEMY

BANI PARK
Computer Application
CLASS 9 sc/comm.
Online session

Java conditional statements:


The java conditional statements are used to check a
condition in the program and then give result branched
in two parts –true result or false result.
There are two types of conditional statements in java-
1. If-Else statement
2. Switch –case statement.

Java If-else Statement


The Java if statement is used to test the
condition. It
checks boolean condition: true or false.
There are various types of if statement
in Java.
o if statement
o if-else statement
o if-else-if ladder
o nested if statement
Java if Statement

The Java if statement tests the


condition. It executes the if block if
condition is true.
Syntax:

if(condition)
{
//code to be executed
}
PRACTICAL DRILL:
1. ENTER A NUMBER AND CHECK IF IT IS AN EVEN NUMBER
OR ODD NUMBER.
2. ENTER A NUMBER AND CHECK IF IT IS POSITIVE OR
NEGATIVE.

You might also like