forked from ChrisMayfield/ThinkJavaCode2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDigitUtil.java
More file actions
27 lines (22 loc) · 599 Bytes
/
DigitUtil.java
File metadata and controls
27 lines (22 loc) · 599 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
public class DigitUtil {
public static boolean isSingleDigit(int x) {
if (x > -10 && x < 10) {
return true;
} else {
return false;
}
}
public static boolean isSingleDigit2(int x) {
return x > -10 && x < 10;
}
public static void main(String[] args) {
System.out.println(isSingleDigit(2));
boolean bigFlag = !isSingleDigit(17);
int z = 9;
if (isSingleDigit(z)) {
System.out.println("z is small");
} else {
System.out.println("z is big");
}
}
}