Skip to content

Commit a0ac5b0

Browse files
committed
feat: Add BooleanLogic class demonstrating boolean operations
Add a new class that demonstrates basic boolean logic operations including: - Boolean variable declaration and initialization - NOT operator usage - Complex boolean expressions with AND/OR operators - Tautology example using (!value1 || value1)
1 parent c0985db commit a0ac5b0

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
public class BooleanLogic {
22
public static void main(String[] args) {
3-
boolean value1, value2; //Declare two boolean variables.
4-
value1 = true; //Initialize one as true.
5-
value2 = !value1; //Initialize the other one as NOT the first one.
6-
//(NOT value1 OR value1) OR (value1 AND NOT value2)
3+
boolean value1, value2;
4+
//Two boolean variable.
5+
6+
value1 = true;
7+
value2 = !value1;
8+
//Initialize the other one as NOT the first one.
9+
710
boolean result = (!value1 || value1) || (value1 && !value2);
11+
//(NOT value1 OR value1) OR (value1 AND NOT value2)
812
}
913
}

0 commit comments

Comments
 (0)