代码拉取完成,页面将自动刷新
public class Book { //定义Book类
private String bookName; //书名
private String author; //作者
private String publisher; //出版社
private String publishDate; //出版日期
public Book(String bookName, String author, String publisher, String publishDate) { //构造方法
this.setBookName(bookName);
this.setAuthor(author);
this.setPublisher(publisher);
this.setPublishDate(publishDate);
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public String getBookName() {
return bookName;
}
public void setAuthor(String author) {
this.author = author;
}
public String getAuthor() {
return author;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public String getPublisher() {
return publisher;
}
public void setPublishDate(String publishDate) {
this.publishDate = publishDate;
}
public String getPublishDate() {
return publishDate;
}
public String toString() {
return "书名:" + this.getBookName() + "\n\t" + "作者:" + this.getAuthor() +
"\n\t" + "出版社:" + this.getPublisher() + "\n\t" + "出版日期:" + this.getPublishDate();
}
public static void main(String[] args) {
Book b1 = new Book("书名1", "作者1", "出版社1", "2010-01-01");
System.out.println(b1);
Book b2 = new Book("书名2", "作者2", "出版社2", "2010-02-02");
System.out.println(b2);
Book b3 = new Book("书名3", "作者3", "出版社3", "2010-03-03");
System.out.println(b3);
}
}
}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。