回答編集履歴
3
修正 InputMismatchException→Exception
answer
CHANGED
@@ -16,7 +16,6 @@
|
|
16
16
|
|
17
17
|
```java
|
18
18
|
import java.util.HashMap;
|
19
|
-
import java.util.InputMismatchException;
|
20
19
|
import java.util.Map;
|
21
20
|
|
22
21
|
public class Fruit {
|
@@ -48,7 +47,7 @@
|
|
48
47
|
}
|
49
48
|
System.out.println(fruitList.get(ans) + "ですね");
|
50
49
|
return finalAnswer(ans);
|
51
|
-
}catch(
|
50
|
+
}catch(Exception e) {
|
52
51
|
return selectWrongNumber();
|
53
52
|
}
|
54
53
|
}
|
@@ -60,7 +59,7 @@
|
|
60
59
|
return fruitList.get(ans);
|
61
60
|
}
|
62
61
|
return selectFruit();
|
63
|
-
}catch(
|
62
|
+
}catch(Exception e) {
|
64
63
|
return finalAnswer(ans);
|
65
64
|
}
|
66
65
|
}
|
@@ -78,5 +77,5 @@
|
|
78
77
|
- [メンバ変数](https://www.javadrive.jp/start/member/)
|
79
78
|
- [staticメソッド/static変数/staticイニシャライザ](https://java-reference.com/java_basic_static.html)
|
80
79
|
- [例外処理](https://www.javadrive.jp/start/exception/index2.html)
|
81
|
-
- [
|
80
|
+
- [Javaの例外処理について](https://qiita.com/k4h4shi/items/2c39edaeef1c92f6644a)
|
82
|
-
java.
|
81
|
+
- [java.lang.Exception](https://docs.oracle.com/javase/jp/8/docs/api/java/lang/Exception.html)
|
2
修正
answer
CHANGED
@@ -72,6 +72,7 @@
|
|
72
72
|
|
73
73
|
```
|
74
74
|
※ざっとしか動作確認してないのでおかしいところあるかもしれませんけど・・
|
75
|
+
※思ってたより時間がかかってしまった。色々機能探りつつ[デバッグ](https://qiita.com/daikete/items/fb70e6e5808b433b9d85)こまかくやりすぎたかも。
|
75
76
|
|
76
77
|
- [HashMap:要素の格納と取り出し](https://www.javadrive.jp/start/hashmap/index2.html)
|
77
78
|
- [メンバ変数](https://www.javadrive.jp/start/member/)
|
1
修正
answer
CHANGED
@@ -78,4 +78,4 @@
|
|
78
78
|
- [staticメソッド/static変数/staticイニシャライザ](https://java-reference.com/java_basic_static.html)
|
79
79
|
- [例外処理](https://www.javadrive.jp/start/exception/index2.html)
|
80
80
|
- [
|
81
|
-
java.
|
81
|
+
java.util.InputMismatchException](https://docs.oracle.com/javase/jp/8/docs/api/java/util/InputMismatchException.html)
|