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 :
if(boolean_expression){ /*statements will execute if the boolean expression is true */ }
Block Diagram :

Example:
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); } }OUTPUT
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