You are here: Home / Topics / If else example in Java

If else example in Java

Filed under: Java on 2023-08-12 20:41:06

//  Simple if else example

class IfElse
{
public static void main( String args[ ] )
{
 int  n;
 
 n = 23;

 if( n > 100 )
 {
  System.out.println( " The number is greater than 100." );
 } 
 else
 {
  System.out.println( " The number is smaller than 100." );
 }
}
}


Output:

The number is smaller than 100.

About Author:
J
Java     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.