If Statement in Java

If block contains the condition, if condition is true, then the statement will execute and if the condition is not true then the statement will not execute.

Syntax :

/*statements will execute if the boolean expression is true */

Block Diagram :



class Test
 public static void main(String []arg)
  // local variable declaration:
  int a = 10; 
  // check the boolean condition
  if( a < 20 ) {
/* if condition is true then print 
   the following */

    System.out.print("a is less than 20");
  System.out.print("\nvalue of a is : "+a);
a is less than 20
value of a is : 10

Next topic is if-else statement


Training For College Campus

We offers college campus training for all streams like CS, IT, ECE, Mechanical, Civil etc. on different technologies like
C, C++, Data Structure, Core Java, Advance Java, Struts Framework, Hibernate, Python, Android, Big-Data, Ebedded & Robotics etc.

Please mail your requirement at info@prowessapps.in

Projects For Students

Students can contact us for their projects on different technologies Core Java, Advance Java, Android etc.

Students can mail requirement at info@prowessapps.in


(8AM to 10PM):

+91-8527238801 , +91-9451396824

© 2017, prowessapps.in, All rights reserved