-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathj19RelationAndLogicalOperator.java
More file actions
40 lines (34 loc) · 1.07 KB
/
j19RelationAndLogicalOperator.java
File metadata and controls
40 lines (34 loc) · 1.07 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
public class j19RelationAndLogicalOperator {
public static void main(String[] args){
/*
Relational Operator
> : Greater than
< : Lowee than
>= : Greater Than Equal to
<= : Lower than Equal to
!= : Not Equal to
== : check Equal to
All Relational Operator always return Boolean value
And we also use these operators in if - else
*/
/*
Logical operator
&& : And
|| : Or
! : Not
Same as And , Or , Not Gate
*/
System.out.println(5>2);
System.out.println(2<5);
System.out.println(5==2);
System.out.println(5!=2);
System.out.println(5<=22);
// Logical operator example
if (5>2 && 5 >1){
System.out.println("Both True So this parra Executed");
}
if (5==2 || 5>2){
System.out.println("If any One if True then Block Executed");
}
}
}