Skip to content

Commit 4e03ff4

Browse files
committed
feat: Add ComparisonOperators class demonstrating relational operations
Add a class to showcase Java comparison operators including: - Less than (<) and greater than or equal to (>=) - Equality (==) and inequality (!=) checks - Logical negation of a comparison - Output of evaluated boolean expressions based on integer values.
1 parent 0114a63 commit 4e03ff4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Section5OperatorExpression/1. Fundamentals/Operators/Comparison Operators/src/ComparisonOperators.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ public class ComparisonOperators
33
public static void main(String[] args)
44
{
55
int number1 = 1, number2 = 2;
6+
67
boolean value1 = number1 < number2;
78
System.out.println("Is number1 less than number2? " + value1);
9+
810
boolean value2 = number1 >= number2;
911
System.out.println("Is number1 greater than or equal to number2? " + value2);
12+
1013
boolean value3 = 2*number1 == number2;
1114
System.out.println("Is two times number1 equal to number2? " + value3);
15+
1216
boolean value4 = !(number1 != number2);
1317
System.out.println("Is number1 not different from number2? " + value4);
1418
}
15-
}
19+
}

0 commit comments

Comments
 (0)