If statement - Java Language Basics

Java examples for Language Basics:if

Introduction

If statement is used to execute an action if particular condition is true.

Syntax of if statement is,

if(<condition>)
   <statement>
     

Demo Code


public class Main {
  public static void main(String[] args) {
     boolean blnStatus = true;
     if(blnStatus){
       System.out.println("Status is true");
     }/*  w w  w.  ja  v a 2s .c o  m*/
  }
}

Result


Related Tutorials