Boolean Datatype Example Java Program
Definition
The boolean data type has only two possible values: true and false. Use this data type for simple flags that track true/false conditions. This data type represents one bit of information.Syntax
boolean varibale_name = true/false;
Syntax Example
boolean gear = true;
Boolean Datatype Example Program
class BooleanDatatype{ public static void main(String[] args){ boolean b=(10>9)?true:false; System.out.println("10>9 is "+b); } }
Sample Output
Output is: 10>9 is true
Data Type Programs
Read More Articles
- Multiple Inheritance Using Interface Example Java Program
- Single Inheritance Example Java Program
- Multilevel Inheritance Example Java Program
- Hierarchical Inheritance Example Java Program
- Find all Substrings of a given string Example Java Program
- Create Matrix Example Java Program
- Sum Of Three Numbers Example Java Program
- Heap Sort Example Java Program
- Twin Prime Example Java Program
- Compile Time Polymorphism Example Java Program