From a122c9a1f0fddce58d4e073e06fa5f4c881e3460 Mon Sep 17 00:00:00 2001 From: Abdul Karim Date: Sat, 14 Feb 2026 14:26:53 +0500 Subject: [PATCH] 6.1 Not: Add another example for better understanding Add example of using boolean NOT operator in Java. --- src/boolean/not.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/boolean/not.md b/src/boolean/not.md index 925d5f80..c93f23ae 100644 --- a/src/boolean/not.md +++ b/src/boolean/not.md @@ -13,3 +13,15 @@ So in this case, I have stuck to my calorie limit if there are _not_ Oreos in th | ---------------- | ------------------- | | false | true | | true | false | + +```java,no_run +boolean isLoggedIn = false; +boolean isGuest = !isLoggedIn; +``` + +Now in this case, if user is _not_ logged in he is a guest. + +| isLoggedIn | isGuest | +| ---------- | ------- | +| false | true | +| true | false |