# About boolean in java

I have always seen people having problem with the boolean in Java. Boolean can be effective to compress the size of your Java program. Here I have tried to give you a simple idea about boolean to clear confusions about boolean.

**What is boolean?**

There are eight type of primitive data types in Java(Read detail here) . Boolean is one of those primitive data types. It can have two possible values: `true`

and `false`

. The values of a boolean is written with the reserver words `true`

and `false`

.

**comparison operators:**

Comparison operators are used to compare the primtive values.

Op | Name | Meaning |
---|---|---|

`i < j` |
less than | `6 < 24` is true. |

`i <= j` |
less than or equal | `6 <= 24` is true. |

`i == j` |
equal | `6 == 24` is false. |

`i >= j` |
greater than or equal | `10 >= 10` is true. |

`i > j` |
greater than | `10 > 10` is false. |

`i != j` |
not equal | `6 != 24` is true. |

comparison operators are also used to compare the values of booleans.

**Logical operators:**

Op | Name | Meaning |
---|---|---|

`a && b` |
and | The result is true only if both a and b are true. |

`a || b` |
or | The result is true if either a or b is true. |

`!a` |
not | true if a is false and false if a is true. |

Happy Programming…. 🙂