Java if statement :

The if statement is the java's conditional branch statement. The general form of if statement is :

if(condition)
statement ;
or
if(condition)
{
statement 1;
statement 2;
.
.
.
statement n;
}

if1

where the condition can be any expression that produces a value true or false. If the condition is true, the statement that follows the if is executed. Otherwise the statement will not execute.
Or, if it contains a block of statement, then if the condition is true then all the statements will execute, and if the condition is false then the control execute the second statement onwards.

Example

class IfDemo
{
    public static void main(String[] args)
    {
        int a=15;
        if(a<20)
        System.out.println("JavaRace");
    }
}

Output
JavaRace

Our Services:

Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Data Science with Python Training | Projects

SILAN Technology, BBSR
Call to: 9439202111  |  9658317757  |  0674-2361252

Comment