forked from naveenanimation20/JavaSessionsCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConditionalOperators.java
More file actions
56 lines (41 loc) · 933 Bytes
/
ConditionalOperators.java
File metadata and controls
56 lines (41 loc) · 933 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package JavaSessions;
public class ConditionalOperators {
public static void main(String[] args) {
int a = 200;
int b = 300;
//= vs ==
if(a==b){
System.out.println("a and b are equal");
}
else{
System.out.println("a and b are not equal");
}
if(b>a){
System.out.println("b is greater than a");
}else{
System.out.println("a is greater than b");
}
if(b>=a){
System.out.println("b is greater than equal to a");
}
//< > <= >= <> !=
int c = 10;
int d = 20;
if(c!=d){
System.out.println("c is not equal to d");
}
//WAP to print the highest number (given three variables)
int x = 500;
int y = 400;
int z = 600;
if(x>y && x>z){ //true && false
System.out.println("x is the highest number");
}
else if(y>z){//false
System.out.println("y is the highest number");
}
else{
System.out.println("z is the highest number");
}
}
}