Java program to study if statements
Java program for how if statement is using in java program.
by Krishna viswambharan
Posted on 20 Jul 2018 Category: Java
Edited on 26 Jul 2018
Java program to study control statements
In this section, we will look closely at control statements. Here we will see the ‘if’ statement. Java ‘if’ statement is syntactically identical to the if statements in C, C++ or C#. Its syntax is shown here.
Here, the condition is a Boolean expression. If the condition is true, then the statement is executed and if it is false, then the statement is bypassed.
Here is a simple java program that illustrates the if statement. This program checks whether the given number is even or odd using Java control statement.
public static void main(String args)
To compile : javac check.java
To Run : java check