Java Design Pattern
Introduction to Java 10
Introduction to Java 11
Introduction to Java 12

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

About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.


We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc






 PreviousNext