Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Item クラスに以下の createItemObj メソッドを追加します。

public static Item createItemObj(String name, String id, int price, int count) {

return

 return new Item(name, id, price, count);

}

・ファクトリメソッドとして登録できるのは、public static なメソッド (インナークラス内のメソッドを除く) です。それ以外のメソッドは登録できません。