We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7fc0d15 commit b006db3Copy full SHA for b006db3
ch06/Exercise.java
@@ -0,0 +1,36 @@
1
+public class Exercise {
2
+
3
+ public static void main(String[] args) {
4
+ boolean flag1 = isHoopy(202);
5
+ boolean flag2 = isFrabjuous(202);
6
+ System.out.println(flag1);
7
+ System.out.println(flag2);
8
+ if (flag1 && flag2) {
9
+ System.out.println("ping!");
10
+ }
11
+ if (flag1 || flag2) {
12
+ System.out.println("pong!");
13
14
15
16
+ public static boolean isHoopy(int x) {
17
+ boolean hoopyFlag;
18
+ if (x % 2 == 0) {
19
+ hoopyFlag = true;
20
+ } else {
21
+ hoopyFlag = false;
22
23
+ return hoopyFlag;
24
25
26
+ public static boolean isFrabjuous(int x) {
27
+ boolean frabjuousFlag;
28
+ if (x > 0) {
29
+ frabjuousFlag = true;
30
31
+ frabjuousFlag = false;
32
33
+ return frabjuousFlag;
34
35
36
+}
0 commit comments