質問編集履歴
6
頂いた回答からコードを書き直しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -26,19 +26,11 @@
|
|
26
26
|
|
27
27
|
```
|
28
28
|
|
29
|
-
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:47: G[: V{���܂
|
30
|
-
|
31
|
-
|
29
|
+
> Task :compileJava FAILED
|
32
|
-
|
33
|
-
|
30
|
+
|
34
|
-
|
35
|
-
V{: ϐ length
|
36
|
-
|
37
|
-
ꏊ: ^CvString̕ϐ str
|
38
|
-
|
39
|
-
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:5
|
31
|
+
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:54: G[: printɓKȃ\bh܂(String,char,char)
|
40
|
-
|
32
|
+
|
41
|
-
out.print("<img src=\"images/%d.png\" alt=\"%d\">",
|
33
|
+
out.print("<img src=\"images/%d.png\" alt=\"%d\">", number.charAt(j), number.charAt(j)); // charAt(j)Ŕz̐擪jԖڂ̗vfo
|
42
34
|
|
43
35
|
^
|
44
36
|
|
@@ -78,7 +70,7 @@
|
|
78
70
|
|
79
71
|
(��XgƉXg̒قȂ܂)
|
80
72
|
|
81
|
-
G[
|
73
|
+
G[1
|
82
74
|
|
83
75
|
|
84
76
|
|
@@ -116,8 +108,6 @@
|
|
116
108
|
|
117
109
|
3 actionable tasks: 1 executed, 2 up-to-date
|
118
110
|
|
119
|
-
|
120
|
-
|
121
111
|
```
|
122
112
|
|
123
113
|
|
@@ -216,13 +206,17 @@
|
|
216
206
|
|
217
207
|
|
218
208
|
|
209
|
+
// ここから下を考える
|
210
|
+
|
211
|
+
|
212
|
+
|
219
|
-
String
|
213
|
+
String number = String.valueOf(i); // iをint型からstr型に変換する
|
220
214
|
|
221
215
|
|
222
216
|
|
223
217
|
int j;
|
224
218
|
|
225
|
-
int n =
|
219
|
+
int n = number.length(); // 文字列の長さを表す
|
226
220
|
|
227
221
|
|
228
222
|
|
@@ -232,7 +226,7 @@
|
|
232
226
|
|
233
227
|
for (j = 0; j < n; j++) { // 文字列の長さ文だけ繰り返す
|
234
228
|
|
235
|
-
out.print("<img src=\"images/%d.png\" alt=\"%d\">",
|
229
|
+
out.print("<img src=\"images/%d.png\" alt=\"%d\">", number.charAt(j), number.charAt(j)); // charAt(j)で配列の先頭からj番目の要素を取り出す
|
236
230
|
|
237
231
|
}
|
238
232
|
|
5
頂いた回答からコードを書き直しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -26,39 +26,19 @@
|
|
26
26
|
|
27
27
|
```
|
28
28
|
|
29
|
-
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:4
|
29
|
+
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:47: G[: V{���܂
|
30
|
-
|
30
|
+
|
31
|
-
|
31
|
+
int n = str.length; // ̒\
|
32
|
-
|
32
|
+
|
33
|
-
|
33
|
+
^
|
34
|
-
|
35
|
-
V{: ϐ Stirng
|
36
|
-
|
37
|
-
ꏊ: NX ImageCounter
|
38
|
-
|
39
|
-
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:49: G[: V{���܂
|
40
|
-
|
41
|
-
int lenght = str.length; //̒\
|
42
|
-
|
43
|
-
^
|
44
34
|
|
45
35
|
V{: ϐ length
|
46
36
|
|
47
37
|
ꏊ: ^CvString̕ϐ str
|
48
38
|
|
49
|
-
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:53: G[: V{���܂
|
50
|
-
|
51
|
-
for(j=0; j < length; j++){ // ̒JԂ
|
52
|
-
|
53
|
-
^
|
54
|
-
|
55
|
-
V{: ϐ length
|
56
|
-
|
57
|
-
ꏊ: NX ImageCounter
|
58
|
-
|
59
|
-
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:5
|
39
|
+
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:52: G[: printɓKȃ\bh܂(String,char,char)
|
60
|
-
|
40
|
+
|
61
|
-
out.print("<img src=\"images/%d.png\" alt=\"%d\">",str.charAt(j),str.charAt(j)); //charAt(j)Ŕz̐擪jԖڂ̗vfo
|
41
|
+
out.print("<img src=\"images/%d.png\" alt=\"%d\">", str.charAt(j), str.charAt(j)); // charAt(j)Ŕz̐擪jԖڂ̗vfo
|
62
42
|
|
63
43
|
^
|
64
44
|
|
@@ -98,7 +78,7 @@
|
|
98
78
|
|
99
79
|
(��XgƉXg̒قȂ܂)
|
100
80
|
|
101
|
-
G[
|
81
|
+
G[2
|
102
82
|
|
103
83
|
|
104
84
|
|
@@ -124,6 +104,20 @@
|
|
124
104
|
|
125
105
|
|
126
106
|
|
107
|
+
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
|
108
|
+
|
109
|
+
Use '--warning-mode all' to show the individual deprecation warnings.
|
110
|
+
|
111
|
+
See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
BUILD FAILED in 1s
|
116
|
+
|
117
|
+
3 actionable tasks: 1 executed, 2 up-to-date
|
118
|
+
|
119
|
+
|
120
|
+
|
127
121
|
```
|
128
122
|
|
129
123
|
|
@@ -170,11 +164,9 @@
|
|
170
164
|
|
171
165
|
@Override
|
172
166
|
|
173
|
-
protected void doGet(HttpServletRequest request,
|
167
|
+
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
174
|
-
|
175
|
-
|
168
|
+
|
176
|
-
|
177
|
-
|
169
|
+
throws ServletException, IOException {
|
178
170
|
|
179
171
|
response.setContentType("text/html; charset=UTF-8");
|
180
172
|
|
@@ -182,13 +174,11 @@
|
|
182
174
|
|
183
175
|
out.println("<html><head></head><body>");
|
184
176
|
|
185
|
-
int i;
|
177
|
+
int i;
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
178
|
+
|
190
|
-
|
179
|
+
|
180
|
+
|
191
|
-
|
181
|
+
File f = new File(getServletContext().getRealPath("/WEB-INF/counter.txt"));
|
192
182
|
|
193
183
|
BufferedReader fin = null;
|
194
184
|
|
@@ -196,21 +186,21 @@
|
|
196
186
|
|
197
187
|
fin = new BufferedReader(new FileReader(f));
|
198
188
|
|
199
|
-
i =
|
189
|
+
i = Integer.parseInt(fin.readLine());
|
200
|
-
|
190
|
+
|
201
|
-
} catch (FileNotFoundException
|
191
|
+
} catch (FileNotFoundException // ファイルがなければ
|
202
|
-
|
192
|
+
|
203
|
-
| NullPointerException
|
193
|
+
| NullPointerException // ファイルが空なら
|
204
|
-
|
194
|
+
|
205
|
-
| NumberFormatException e) { // 数でないならば
|
195
|
+
| NumberFormatException e) { // 数でないならば
|
206
|
-
|
196
|
+
|
207
|
-
i = 0;
|
197
|
+
i = 0; // 0 に
|
208
198
|
|
209
199
|
} finally {
|
210
200
|
|
211
201
|
if (fin != null) {
|
212
202
|
|
213
|
-
fin.close();
|
203
|
+
fin.close(); // closeを忘れない
|
214
204
|
|
215
205
|
}
|
216
206
|
|
@@ -222,17 +212,17 @@
|
|
222
212
|
|
223
213
|
fout.println(++i);
|
224
214
|
|
225
|
-
fout.close();
|
215
|
+
fout.close(); // closeを忘れない
|
226
|
-
|
227
|
-
|
228
|
-
|
216
|
+
|
217
|
+
|
218
|
+
|
229
|
-
String str = Sti
|
219
|
+
String str = String.valueOf(i); // iをint型からstr型に変換する
|
230
|
-
|
231
|
-
|
220
|
+
|
221
|
+
|
232
222
|
|
233
223
|
int j;
|
234
224
|
|
235
|
-
int
|
225
|
+
int n = str.length; // 文字列の長さを表す
|
236
226
|
|
237
227
|
|
238
228
|
|
@@ -240,26 +230,24 @@
|
|
240
230
|
|
241
231
|
|
242
232
|
|
243
|
-
for(j=0; j <
|
233
|
+
for (j = 0; j < n; j++) { // 文字列の長さ文だけ繰り返す
|
244
|
-
|
234
|
+
|
245
|
-
out.print("<img src=\"images/%d.png\" alt=\"%d\">",str.charAt(j),str.charAt(j)); //charAt(j)で配列の先頭からj番目の要素を取り出す
|
235
|
+
out.print("<img src=\"images/%d.png\" alt=\"%d\">", str.charAt(j), str.charAt(j)); // charAt(j)で配列の先頭からj番目の要素を取り出す
|
246
236
|
|
247
237
|
}
|
248
238
|
|
249
239
|
|
250
240
|
|
251
|
-
out.print("番目の来訪者です。");
|
241
|
+
out.print("番目の来訪者です。");
|
252
242
|
|
253
243
|
out.println("</body></html>");
|
254
244
|
|
255
|
-
out.close();
|
245
|
+
out.close(); // closeを忘れない
|
256
246
|
|
257
247
|
}
|
258
248
|
|
259
249
|
}
|
260
250
|
|
261
|
-
}
|
262
|
-
|
263
251
|
```
|
264
252
|
|
265
253
|
|
4
頂いた回答からコードを書き直しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -258,7 +258,9 @@
|
|
258
258
|
|
259
259
|
}
|
260
260
|
|
261
|
+
}
|
262
|
+
|
261
|
-
|
263
|
+
```
|
262
264
|
|
263
265
|
|
264
266
|
|
3
頂いた回答からコードを書き直しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -26,21 +26,79 @@
|
|
26
26
|
|
27
27
|
```
|
28
28
|
|
29
|
-
> Task :compileJava FAILED
|
30
|
-
|
31
|
-
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:
|
29
|
+
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:46: G[: V{���܂
|
32
|
-
|
30
|
+
|
33
|
-
|
31
|
+
String str = Stirng.valueOf(i); // iint^str^ɕϊ
|
34
|
-
|
32
|
+
|
35
|
-
|
33
|
+
^
|
34
|
+
|
36
|
-
|
35
|
+
V{: ϐ Stirng
|
36
|
+
|
37
|
+
ꏊ: NX ImageCounter
|
38
|
+
|
37
|
-
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:
|
39
|
+
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:49: G[: V{���܂
|
38
|
-
|
40
|
+
|
39
|
-
|
41
|
+
int lenght = str.length; //̒\
|
40
|
-
|
42
|
+
|
41
|
-
|
43
|
+
^
|
44
|
+
|
42
|
-
|
45
|
+
V{: ϐ length
|
46
|
+
|
47
|
+
ꏊ: ^CvString̕ϐ str
|
48
|
+
|
49
|
+
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:53: G[: V{���܂
|
50
|
+
|
51
|
+
for(j=0; j < length; j++){ // ̒JԂ
|
52
|
+
|
53
|
+
^
|
54
|
+
|
55
|
+
V{: ϐ length
|
56
|
+
|
57
|
+
ꏊ: NX ImageCounter
|
58
|
+
|
59
|
+
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:54: G[: printɓKȃ\bh܂(String,char,char)
|
60
|
+
|
61
|
+
out.print("<img src=\"images/%d.png\" alt=\"%d\">",str.charAt(j),str.charAt(j)); //charAt(j)Ŕz̐擪jԖڂ̗vfo
|
62
|
+
|
63
|
+
^
|
64
|
+
|
65
|
+
\bh PrintWriter.print(boolean)͎gpł܂
|
66
|
+
|
67
|
+
(��XgƉXg̒قȂ܂)
|
68
|
+
|
69
|
+
\bh PrintWriter.print(char)͎gpł܂
|
70
|
+
|
71
|
+
(��XgƉXg̒قȂ܂)
|
72
|
+
|
73
|
+
\bh PrintWriter.print(int)͎gpł܂
|
74
|
+
|
75
|
+
(��XgƉXg̒قȂ܂)
|
76
|
+
|
77
|
+
\bh PrintWriter.print(long)͎gpł܂
|
78
|
+
|
79
|
+
(��XgƉXg̒قȂ܂)
|
80
|
+
|
81
|
+
\bh PrintWriter.print(float)͎gpł܂
|
82
|
+
|
83
|
+
(��XgƉXg̒قȂ܂)
|
84
|
+
|
85
|
+
\bh PrintWriter.print(double)͎gpł܂
|
86
|
+
|
87
|
+
(��XgƉXg̒قȂ܂)
|
88
|
+
|
89
|
+
\bh PrintWriter.print(char[])͎gpł܂
|
90
|
+
|
91
|
+
(��XgƉXg̒قȂ܂)
|
92
|
+
|
93
|
+
\bh PrintWriter.print(String)͎gpł܂
|
94
|
+
|
95
|
+
(��XgƉXg̒قȂ܂)
|
96
|
+
|
97
|
+
\bh PrintWriter.print(Object)͎gpł܂
|
98
|
+
|
99
|
+
(��XgƉXg̒قȂ܂)
|
100
|
+
|
43
|
-
G[
|
101
|
+
G[4
|
44
102
|
|
45
103
|
|
46
104
|
|
@@ -66,20 +124,6 @@
|
|
66
124
|
|
67
125
|
|
68
126
|
|
69
|
-
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
|
70
|
-
|
71
|
-
Use '--warning-mode all' to show the individual deprecation warnings.
|
72
|
-
|
73
|
-
See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
BUILD FAILED in 2s
|
78
|
-
|
79
|
-
3 actionable tasks: 1 executed, 2 up-to-date
|
80
|
-
|
81
|
-
|
82
|
-
|
83
127
|
```
|
84
128
|
|
85
129
|
|
@@ -182,7 +226,7 @@
|
|
182
226
|
|
183
227
|
|
184
228
|
|
185
|
-
String
|
229
|
+
String str = Stirng.valueOf(i); // iをint型からstr型に変換する
|
186
230
|
|
187
231
|
|
188
232
|
|
@@ -196,9 +240,9 @@
|
|
196
240
|
|
197
241
|
|
198
242
|
|
199
|
-
for(j=0; j < length; j++){
|
243
|
+
for(j=0; j < length; j++){ // 文字列の長さ文だけ繰り返す
|
200
|
-
|
244
|
+
|
201
|
-
out.print("<img src=\"images/%d.png\" alt=\"%d\">",str.charAt(j),str.charAt(j));
|
245
|
+
out.print("<img src=\"images/%d.png\" alt=\"%d\">",str.charAt(j),str.charAt(j)); //charAt(j)で配列の先頭からj番目の要素を取り出す
|
202
246
|
|
203
247
|
}
|
204
248
|
|
@@ -212,6 +256,8 @@
|
|
212
256
|
|
213
257
|
}
|
214
258
|
|
259
|
+
}
|
260
|
+
|
215
261
|
}```
|
216
262
|
|
217
263
|
|
2
試したことを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -26,43 +26,21 @@
|
|
26
26
|
|
27
27
|
```
|
28
28
|
|
29
|
-
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:46: G[: '\u3000'͕sȕł
|
30
|
-
|
31
|
-
String@str = Stirng.valueOf(i); //@iint^str^ɕϊ
|
32
|
-
|
33
|
-
^
|
34
|
-
|
35
|
-
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:46: G[: ł͂܂
|
36
|
-
|
37
|
-
String@str = Stirng.valueOf(i); //@iint^str^ɕϊ
|
38
|
-
|
39
|
-
^
|
40
|
-
|
41
|
-
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:53: G[: ';'܂
|
42
|
-
|
43
|
-
|
29
|
+
> Task :compileJava FAILED
|
44
|
-
|
45
|
-
^
|
46
30
|
|
47
31
|
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:53: G[: '\u3000'͕sȕł
|
48
32
|
|
49
|
-
for(j=0 j < length; j++){@@// ̒JԂ
|
33
|
+
for(j=0; j < length; j++){@@// ̒JԂ
|
50
|
-
|
34
|
+
|
51
|
-
^
|
35
|
+
^
|
52
36
|
|
53
37
|
C:\Users\19t339\Desktop\OOPLGradle\src\main\java\ImageCounter.java:53: G[: '\u3000'͕sȕł
|
54
38
|
|
55
|
-
for(j=0 j < length; j++){@@// ̒JԂ
|
39
|
+
for(j=0; j < length; j++){@@// ̒JԂ
|
56
|
-
|
40
|
+
|
57
|
-
^
|
41
|
+
^
|
58
|
-
|
59
|
-
|
42
|
+
|
60
|
-
|
61
|
-
out.print("<img src=\"images/%d.png\" alt=\"%d\">",str.charAt(j),str.charAt(j);
|
62
|
-
|
63
|
-
^
|
64
|
-
|
65
|
-
G[
|
43
|
+
G[2
|
66
44
|
|
67
45
|
|
68
46
|
|
@@ -218,9 +196,9 @@
|
|
218
196
|
|
219
197
|
|
220
198
|
|
221
|
-
for(j=0 j < length; j++){ // 文字列の長さ文だけ繰り返す
|
199
|
+
for(j=0; j < length; j++){ // 文字列の長さ文だけ繰り返す
|
222
|
-
|
200
|
+
|
223
|
-
out.print("<img src=\"images/%d.png\" alt=\"%d\">",str.charAt(j),str.charAt(j);
|
201
|
+
out.print("<img src=\"images/%d.png\" alt=\"%d\">",str.charAt(j),str.charAt(j));
|
224
202
|
|
225
203
|
}
|
226
204
|
|
1
試したことを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -244,7 +244,7 @@
|
|
244
244
|
|
245
245
|
ソースを見返したり、エラーの該当箇所を確認しました。
|
246
246
|
|
247
|
-
|
247
|
+
エラー内容を翻訳しました。
|
248
248
|
|
249
249
|
### 補足情報(FW/ツールのバージョンなど)
|
250
250
|
|