2日目_段階1_完了

This commit is contained in:
2026-09-15 14:36:27 +09:00
parent 7559a7dfa7
commit c82f9ca678
6 changed files with 65 additions and 24 deletions

View File

@@ -1,7 +1,24 @@
public class Book {
String title;
String author;
int price;
public String title;
public String author;
public int price;
//引数なしコンストラクタ
public Book() {
this.title = "タイトル未設定";
this.author = "著者未設定";
this.price = 0;
// System.out.println("コンストラクタが呼び出されました");
}
//引数ありコンストラクタ
public Book(String title, String author, int price) {
// System.out.println("引数なしのコンストラクタが呼び出されました");
this.title = title;
this.author = author;
this.price = price;
}
}