修改项目目录
This commit is contained in:
36
src/chapter3/demo31/Book.java
Normal file
36
src/chapter3/demo31/Book.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package chapter3.demo31;
|
||||
|
||||
public class Book {
|
||||
private final int id; // 编号
|
||||
private final String name; // 书名
|
||||
private final double price; // 价格
|
||||
private final int storage; // 库存
|
||||
|
||||
// 有参构造
|
||||
public Book(int id, String name, double price, int storage) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
// 获取书号
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
// 获取书名
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
// 获取价格
|
||||
public double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
// 获取库存
|
||||
public int getStorage() {
|
||||
return storage;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user