質問編集履歴
2
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
|
5
5
|
class MissingNameException extends Exception { }
|
6
6
|
|
7
|
-
class
|
7
|
+
class Patron {
|
8
8
|
|
9
9
|
private int id;
|
10
10
|
|
11
11
|
private String name;
|
12
12
|
|
13
|
-
public
|
13
|
+
public Patron(int id, String name) throws Exception {
|
14
14
|
|
15
15
|
if (id < 1) {
|
16
16
|
|
@@ -36,19 +36,19 @@
|
|
36
36
|
|
37
37
|
}
|
38
38
|
|
39
|
-
public class
|
39
|
+
public class Owner {
|
40
40
|
|
41
41
|
//public static void main(String[] args) { // 1.add throws declaration 2.surround with try/catch
|
42
42
|
|
43
43
|
public static void main(String[] args) throws Exception {
|
44
44
|
|
45
|
-
|
45
|
+
Patron p1 = new Patron(101, "Beethoven");
|
46
46
|
|
47
|
-
|
47
|
+
Patron p2 = new Patron(102, "Mozart");
|
48
48
|
|
49
|
-
System.out.print(
|
49
|
+
System.out.print(p1);
|
50
50
|
|
51
|
-
System.out.print(
|
51
|
+
System.out.print(p2);
|
52
52
|
|
53
53
|
}
|
54
54
|
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -56,7 +56,7 @@
|
|
56
56
|
|
57
57
|
```
|
58
58
|
|
59
|
-
ある問題集のスクリプトですが、throws を書いているのに catch がないのですが、エラーなく実行で
|
59
|
+
ある問題集のスクリプトですが、throws を書いているのに catch がないのですが、エラーなく実行できてしまいます。
|
60
60
|
|
61
61
|
|
62
62
|
|