Sponsered Links
Categories
Sponsered Links

Java if condition

 

 This example shows that how to used the if condition in java source code.

The if statement is conditional branch statement. It can be used to route program execution through two different path's. It tells your program to execute a certain section of code only if a particular test evaluates to true. Here is the general form of if statement.

 Syntax:-

if(condition)
{
    statement1;
}

Source cod e of ifDemo.java : 

class ifDemo{
 public static void main(String arg[]){
   int a=5,b=10;
    if(a <b)
    {
      System.out.println("a is less than b");
    }
  }
}

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved