forked from AllenDowney/ThinkJavaCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogic.java
More file actions
28 lines (22 loc) · 886 Bytes
/
Logic.java
File metadata and controls
28 lines (22 loc) · 886 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
// Exercise 5-ES-1
// Exercise 2
public class Logic
{
public static void main(String[] args)
{
boolean yes = true;
boolean no = false;
//Add these lines to test if both conditions are true.
System.out.println("Both YesYes True: " + ( yes && yes));
System.out.println("Both YesNo True: " + ( yes && no));
System.out.println();
//Add these lines to test if either condition is true.
System.out.println("Either YesYes True: " + ( yes || yes));
System.out.println("Either YesNo True: " + ( yes || no));
System.out.println("Either NoNo True: " + ( no || no));
System.out.println();
//Add two more lines to show an original and inverse value.
System.out.println("Original Yes Value: " + ( yes ));
System.out.println("Inverse Yes Value: " + ( !yes ));
}
}