-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbooleanOperators.java
More file actions
35 lines (22 loc) · 866 Bytes
/
Copy pathbooleanOperators.java
File metadata and controls
35 lines (22 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package week2Videos;
public class booleanOperators {
public static void main(String[] args) {
// == Equality Operator
System.out.println(" == ");
System.out.println( 2 == 2);//true
System.out.println( 2 > 5);//false
System.out.println( 3 <= 5);//true
System.out.println( 5 <= 5);//true
// && Both sides HAVE to be true
System.out.println(" && ");
System.out.println( 2 == 2 && 1 < 5); //true
System.out.println( true && true);//true
System.out.println( true && false); // false
// || means one of the comparisons HAS to be true
System.out.println("||");
System.out.println(true || false);//true
System.out.println( false || false);// false because one of them is not true
System.out.println( 2 == 2 || 1 == 5);//true
System.out.println( 2 == 1 || 2 == 3);//false bacause one of them is not true
}
}