回答編集履歴
4
追記
answer
CHANGED
@@ -7,10 +7,21 @@
|
|
7
7
|
他も同様です。『引数を』代入する処理に書き直してください。
|
8
8
|
|
9
9
|
---
|
10
|
-
個人的には、
|
11
|
-
次のような
|
10
|
+
個人的には、次のような書き方の方が分かりやすいと思います。
|
12
11
|
```Java
|
12
|
+
public Seiseki() {
|
13
|
+
this("特別研究");
|
14
|
+
}
|
15
|
+
public Seiseki(String course) {
|
16
|
+
this(course, "専門科目");
|
17
|
+
}
|
18
|
+
public Seiseki(String course, String category) {
|
19
|
+
this(course, category, 6);
|
20
|
+
}
|
21
|
+
public Seiseki(String course, String category, int credit) {
|
22
|
+
this(course, category, credit, 5);
|
23
|
+
}
|
13
|
-
public Seiseki(String course, String category, int credit, int grade){
|
24
|
+
public Seiseki(String course, String category, int credit, int grade) {
|
14
25
|
this.course = course;
|
15
26
|
this.category = category;
|
16
27
|
this.credit = credit;
|
3
スペルの誤りを修正
answer
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
次のようなコンストラクタを他のコンストラクタが呼び出す形の方が書きやすいと思います。
|
12
12
|
```Java
|
13
13
|
public Seiseki(String course, String category, int credit, int grade){
|
14
|
-
this.
|
14
|
+
this.course = course;
|
15
15
|
this.category = category;
|
16
16
|
this.credit = credit;
|
17
17
|
this.grade = grade;
|
2
追記
answer
CHANGED
@@ -16,5 +16,9 @@
|
|
16
16
|
this.credit = credit;
|
17
17
|
this.grade = grade;
|
18
18
|
}
|
19
|
+
```
|
19
20
|
|
21
|
+
質問の仕方について
|
20
|
-
|
22
|
+
---
|
23
|
+
teratailには、上記のようにコードを見やすく表示する機能があります。
|
24
|
+
質問編集画面を開き、コードを選択した状態で<code>ボタンを押してください。
|
1
追記
answer
CHANGED
@@ -4,4 +4,17 @@
|
|
4
4
|
public Seiseki(String course){this.course = "特別研究";}
|
5
5
|
> ```
|
6
6
|
|
7
|
-
他も同様です。『引数を』代入する処理に書き直してください。
|
7
|
+
他も同様です。『引数を』代入する処理に書き直してください。
|
8
|
+
|
9
|
+
---
|
10
|
+
個人的には、
|
11
|
+
次のようなコンストラクタを他のコンストラクタが呼び出す形の方が書きやすいと思います。
|
12
|
+
```Java
|
13
|
+
public Seiseki(String course, String category, int credit, int grade){
|
14
|
+
this.cource = cource;
|
15
|
+
this.category = category;
|
16
|
+
this.credit = credit;
|
17
|
+
this.grade = grade;
|
18
|
+
}
|
19
|
+
|
20
|
+
```
|