首页 > 代码库 > 图书类 属性私有,生成其共有的get/set

图书类 属性私有,生成其共有的get/set

public class Book0 {	/**	 * @param args	 */	public static void main(String[] args) {		// TODO 自动生成的方法存根		Book1 book = new Book1("123456","Java","zhangsan","zzzzzz",59);	     book.show();	}}class Book1{	private String bookId;	private String bookName;	private String author;	private String publisher;	private int price;	public Book1(){			}	public Book1(String bookId,String bookName,String author,String publisher,int price){		this.bookId=bookId;		this.bookName=bookName;		this.author=author;		this.publisher=publisher;		this.price=price;	}	public void show(){    System.out.println("书籍编号:"+bookId);    System.out.println("书名:"+bookName);    System.out.println("作者名:"+author);    System.out.println("出版社:"+publisher);    System.out.println("价钱:"+price);	}			public String getBookId() {		return bookId;	}	public void setBookId(String bookId) {		this.bookId = bookId;	}	public String getBookName() {		return bookName;	}	public void setBookName(String bookName) {		this.bookName = bookName;	}	public String getAuthor() {		return author;	}	public void setAuthor(String author) {		this.author = author;	}	public String getPublisher() {		return publisher;	}	public void setPublisher(String publisher) {		this.publisher = publisher;	}	public int getPrice() {		return price;	}	public void setPrice(int price) {		this.price = price;	}

图书类 属性私有,生成其共有的get/set