You are here: Home / Topics / Boolean Data Type in Java

Boolean Data Type in Java

Filed under: Java on 2023-08-11 19:09:55

// Boolean variable Example

class BoolTest 
{
public static void main(String args[ ]) 
{
 boolean b;
 b = false;
 System.out.println("b is " + b);

 b = true;
 System.out.println("b is " + b);

 if(b)
 {  
  System.out.println("This is executed.");
 }

}
}


Output:

b is false
This is executed.

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