質問編集履歴
2
era
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
erarraylist addの使い方【JAVA】
|
body
CHANGED
@@ -36,4 +36,11 @@
|
|
36
36
|
}
|
37
37
|
```
|
38
38
|
|
39
|
+
エラー;
|
39
|
-
|
40
|
+
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 5 out of bounds for length 5
|
41
|
+
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
|
42
|
+
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
|
43
|
+
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
|
44
|
+
at java.base/java.util.Objects.checkIndex(Objects.java:359)
|
45
|
+
at java.base/java.util.ArrayList.get(ArrayList.java:427)
|
46
|
+
at Main.main(Main.java:50)
|
1
sc al
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
リストに入れたものを繰り返し取り出したいのですが、エラーになってしまいます。
|
2
2
|
|
3
3
|
```JAVA
|
4
|
+
Scanner sc = new Scanner(System.in);
|
5
|
+
List<Double> al = new ArrayList<Double>();
|
4
6
|
int b = -1;
|
5
7
|
for(int j = 0; j < camera; j++) {
|
6
8
|
x = sc.nextDouble();
|