Skip to content

Commit 0114a63

Browse files
committed
feat: Add BooleanOperators class demonstrating boolean logic operations
Add a class to illustrate basic boolean logic including: - Declaration and initialization of boolean variables - Use of NOT (!) operator - Logical AND (&&) and OR (||) operations - A compound boolean expression using NOT and AND.
1 parent 85752ae commit 0114a63

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Section5OperatorExpression/1. Fundamentals/Operators/Boolean Operators/src/BooleanOperators.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@ public class BooleanOperators
33
public static void main(String[] args)
44
{
55
boolean statement1 = true, statement2 = false;
6+
67
System.out.print("Not true is ");
8+
79
System.out.println(!statement1);
10+
811
System.out.print("True and false is ");
12+
913
System.out.println(statement1 && statement2);
14+
1015
System.out.print("True or false is ");
16+
1117
System.out.println(statement1 || statement2);
18+
1219
System.out.print("Not (True and not false) is ");
20+
1321
System.out.println(!(statement1 && !statement2));
1422
}
15-
}
23+
}

0 commit comments

Comments
 (0)