/
InputRightCurlyDoWhile2.java
93 lines (77 loc) · 2.13 KB
/
InputRightCurlyDoWhile2.java
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks;
import java.util.Scanner;
/**
* Test input for GitHub issue #3090.
* https://github.com/checkstyle/checkstyle/issues/3090
*/
public class InputRightCurlyDoWhile2 {
public void foo1() {
do {
} while (true);
}
public void foo2() {
int i = 1;
while (i < 5) {
String.CASE_INSENSITIVE_ORDER.equals(i + " ");
i++;
}
}
public void foo3() {
int i = 1;
do {
i++;
String.CASE_INSENSITIVE_ORDER.equals(i + " ");
} while (i < 5);
}
public void foo4() {
int prog, user;
prog = (int)(Math.random() * 10) + 1;
Scanner input = new Scanner(System.in, "utf-8");
if( input.hasNextInt() ) {
do {
user = input.nextInt();
if(user == prog) {
String.CASE_INSENSITIVE_ORDER.equals("Good!");
} else {
if (user > 0 && user <= 10) {
String.CASE_INSENSITIVE_ORDER.equals("Bad! ");
if( prog < user ) {
String.CASE_INSENSITIVE_ORDER.equals("My number is less than yours.");
} else {
String.CASE_INSENSITIVE_ORDER.equals("My number is greater than yours");
}
} else {
String.CASE_INSENSITIVE_ORDER.equals("Violation!");
}
}
} while( user != prog );
} else {
String.CASE_INSENSITIVE_ORDER.equals("Violation!");
}
String.CASE_INSENSITIVE_ORDER.equals("Goodbye!");
}
public void foo5() {
do {
} // warn
while (true);
}
public void foo6() {
do {} // warn
while (true);
}
public void foo7() {
do
{
} while (true);
}
public void foo8() {
do
{
} // warn
while
(true);
}
public void foo9() {
do {} while (true);
}
}