1段階目終わりました
This commit is contained in:
@@ -3,13 +3,15 @@ public class BasicCheck1 {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
Book book = new Book();
|
Book book1 = new Book();
|
||||||
String title = "吾輩は猫である";
|
Book book2 = new Book("銀河鉄道の夜", "宮沢賢治", 500);
|
||||||
String author = "夏目礎石";
|
|
||||||
int price = 800;
|
|
||||||
System.out.println(title);
|
System.out.println(book1.title + "\n" + book1.author + "\n" + book1.price);
|
||||||
System.out.println(author);
|
System.out.println(book2.title + "\n" + book2.author + "\n" + book2.price);
|
||||||
System.out.println(price);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,25 @@
|
|||||||
|
|
||||||
public class Book {
|
public class Book {
|
||||||
|
|
||||||
|
|
||||||
String title;
|
String title;
|
||||||
String author ;
|
String author ;
|
||||||
int price;
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user