Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b006db3

Browse filesBrowse files
committed
read through ch06
1 parent 7fc0d15 commit b006db3
Copy full SHA for b006db3

File tree

Expand file treeCollapse file tree

1 file changed

+36
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+36
-0
lines changed
Open diff view settings
Collapse file

‎ch06/Exercise.java‎

Copy file name to clipboard
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
} else {
31+
frabjuousFlag = false;
32+
}
33+
return frabjuousFlag;
34+
}
35+
36+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.