回答編集履歴
2
インデントの修正
answer
CHANGED
@@ -16,10 +16,10 @@
|
|
16
16
|
}
|
17
17
|
public void setPrice(Integer price) {
|
18
18
|
if (price.intValue() >= 0)
|
19
|
-
|
19
|
+
// priceが0以上の場合はそのまま代入
|
20
20
|
this.price = price;
|
21
21
|
} else {
|
22
|
-
|
22
|
+
// 0以下の場合は例外をスローする
|
23
23
|
throw new HogeException("price is NOT positive number.");
|
24
24
|
}
|
25
25
|
}
|
1
ソースコードミス
answer
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
return price;
|
16
16
|
}
|
17
17
|
public void setPrice(Integer price) {
|
18
|
-
if (price.intValue >= 0)
|
18
|
+
if (price.intValue() >= 0)
|
19
19
|
// priceが0以上の場合はそのまま代入
|
20
20
|
this.price = price;
|
21
21
|
} else {
|