28 lines
453 B
Java
28 lines
453 B
Java
|
|
public class Book {
|
|
|
|
String title;
|
|
String author;
|
|
int price;
|
|
|
|
public Book() {
|
|
this.title = "タイトル未設定";
|
|
this.author = "著者未設定";
|
|
this.price = 0;
|
|
|
|
}
|
|
public Book(String title, String author, int price) {
|
|
this.title = title;
|
|
this.author = author;
|
|
this.price = price;
|
|
|
|
|
|
}
|
|
|
|
public void output() {
|
|
System.out.println(this.title);
|
|
System.out.println(this.author);
|
|
System.out.println(this.price);
|
|
}
|
|
}
|