-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLesson7LogicalOperators.java
More file actions
27 lines (23 loc) · 1.01 KB
/
Lesson7LogicalOperators.java
File metadata and controls
27 lines (23 loc) · 1.01 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
public class Lesson7LogicalOperators {
public static void main(String []args ){
/* LOGICAL OPERATORS IN JAVA
- They allow us to check or modify more than one condition.They include :
&& = AND checks more than one condition.. all the tested condition should be true
|| = OR..tests between two conditions .. one of them must be true for the code to be executed
! = NOT... checks to see if the condition is not true/ false
*/
double temp=2000;
boolean isSunny=true;
if (temp<=30 && temp>=0 && isSunny){
System.out.println("the weather is amazing today ");
System.out.println("its sunny outside");
}
else if (temp <=30 && temp>=0 && !isSunny){
System.out.println("The Weather is Good \n" +
"Its Cloudy outside ☁");
}
else if (temp>30||temp<0){
System.out.println("The weather is bad 😢");
}
}
}