-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path18_RelationalOperator.java
More file actions
44 lines (33 loc) · 1.03 KB
/
18_RelationalOperator.java
File metadata and controls
44 lines (33 loc) · 1.03 KB
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
36
37
38
39
40
41
42
43
44
import java.util.*;
class Solution {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
boolean a = true;
boolean b = false;
System.out.println("a && b = " + (a && b));
System.out.println("a || b = " + (a || b));
System.out.println("!(a && b) = " + !(a && b));
// We can concatinate logic to string but not to int. To be Noted.
System.out.println("Logic: " + false);
if (true) {
System.out.println("Logic: " + true);
}
if (!true) {
System.out.println("Logic: !true");
}
else {
System.out.println("Logic: !true: else");
}
}
}
class Solution1 {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int a, b;
a = 10;
b = (a == 1) ? 20: 30;
System.out.println("Value of b is : " + b);
b = (a == 10) ? 20: 30;
System.out.println("Value of b is : " + b);
}
}