Java if Statement with Example

A programming language uses control statements to control the flow of execution of a program. In Java programming, we can control the flow of execution of a program based on some conditions. Java control statements can be put into the following three categories: selection, iteration, and jump.

Java if Statement:

if statement in Java is a simple decision-making statement. Java if statement is used to decide whether a certain statement or block of the statement will be executed or not. If a certain condition is true, then the block of statement is executed, otherwise not. 



//statement to be execute.
//if condition is true.


Java if statement

Java if statement Example:

class ifExample{
	public static void main(String args[]){
		int a = 10;
		if( a > 5){
			System.out.println("If block executed");	


 if block executed 

you may also like these related posts:

7. Java Collection framework complete tutorial.
8. Java Hashtable with example.
9. Java constructor with example.
10. Exception handling in java with example.
Java if Statement with Example Java if Statement with Example Reviewed by Prashant Srivastava on December 16, 2019 Rating: 5

No comments:

Powered by Blogger.