1700456194
1700456195
public String getAuthor();
1700456196
1700456197
}
1700456198
1700456199
目前书店只出售小说类书籍,小说类如代码清单6-2所示。
1700456200
1700456201
代码清单6-2 小说类
1700456202
1700456203
public class NovelBook implements IBook{
1700456204
1700456205
//书籍名称
1700456206
1700456207
private String name;
1700456208
1700456209
//书籍的价格
1700456210
1700456211
private int price;
1700456212
1700456213
//书籍的作者
1700456214
1700456215
private String author;
1700456216
1700456217
//通过构造函数传递书籍数据
1700456218
1700456219
public NovelBook(String_name,int_price,String_author){
1700456220
1700456221
this.name=_name;
1700456222
1700456223
this.price=_price;
1700456224
1700456225
this.author=_author;
1700456226
1700456227
}
1700456228
1700456229
//获得作者是谁
1700456230
1700456231
public String getAuthor(){
1700456232
1700456233
return this.author;
1700456234
1700456235
}
1700456236
1700456237
//书籍叫什么名字
1700456238
1700456239
public String getName(){
1700456240
1700456241
return this.name;
1700456242
1700456243
}
[
上一页 ]
[ :1.700456194e+09 ]
[
下一页 ]