JavaSE创建实体类

JavaSE实体类

1.写表中的变量

public class Book {
	public int id;
	public String bookname;
	public String bookauthor;
	public String bookuser;
	public String booktext;
	public int booklevel;
	public int booktype;
	public int bookprice;
	public int bookflag;
	public int flagdeteled;
	public String bookaddress;
	public String bookpublic;
	public String bookmobile;
}

2.shift+alt+s

①Generate Getters and Setters...

public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getBookname() {
		return bookname;
	}

	public void setBookname(String bookname) {
		this.bookname = bookname;
	}

	public String getBookauthor() {
		return bookauthor;
	}

	public void setBookauthor(String bookauthor) {
		this.bookauthor = bookauthor;
	}

	public String getBookuser() {
		return bookuser;
	}

	public void setBookuser(String bookuser) {
		this.bookuser = bookuser;
	}

	public String getBooktext() {
		return booktext;
	}

	public void setBooktext(String booktext) {
		this.booktext = booktext;
	}

	public int getBooklevel() {
		return booklevel;
	}

	public void setBooklevel(int booklevel) {
		this.booklevel = booklevel;
	}

	public int getBooktype() {
		return booktype;
	}

	public void setBooktype(int booktype) {
		this.booktype = booktype;
	}

	public int getBookprice() {
		return bookprice;
	}

	public void setBookprice(int bookprice) {
		this.bookprice = bookprice;
	}

	public int getBookflag() {
		return bookflag;
	}

	public void setBookflag(int bookflag) {
		this.bookflag = bookflag;
	}

	public int getFlagdeteled() {
		return flagdeteled;
	}

	public void setFlagdeteled(int flagdeteled) {
		this.flagdeteled = flagdeteled;
	}

	public String getBookaddress() {
		return bookaddress;
	}

	public void setBookaddress(String bookaddress) {
		this.bookaddress = bookaddress;
	}

	public String getBookpublic() {
		return bookpublic;
	}

	public void setBookpublic(String bookpublic) {
		this.bookpublic = bookpublic;
	}

	public String getBookmobile() {
		return bookmobile;
	}

	public void setBookmobile(String bookmobile) {
		this.bookmobile = bookmobile;
	}

②Generate  toString()...

@Override
public String toString() {
    return "Book [id=" + id + ", bookname=" + bookname + ", bookauthor=" + bookauthor + ", bookuser=" + bookuser+ ", booktext=" + booktext + ", booklevel=" + booklevel + ",booktype=" + booktype + ", bookprice="+ bookprice + ", bookflag=" + bookflag + ", flagdeteled=" + flagdeteled + ", bookaddress=" + bookaddress+ ", bookpublic=" + bookpublic + ",bookmobile=" + bookmobile + "]";
}

 

③Generate  Constructor using Fields...

public Book(int id, String bookname, String bookauthor, String bookuser, String booktext, int booklevel,
			int booktype, int bookprice, int bookflag, int flagdeteled, String bookaddress, String bookpublic,
			String bookmobile) {
		super();
		this.id = id;
		this.bookname = bookname;
		this.bookauthor = bookauthor;
		this.bookuser = bookuser;
		this.booktext = booktext;
		this.booklevel = booklevel;
		this.booktype = booktype;
		this.bookprice = bookprice;
		this.bookflag = bookflag;
		this.flagdeteled = flagdeteled;
		this.bookaddress = bookaddress;
		this.bookpublic = bookpublic;
		this.bookmobile = bookmobile;
	}

④Generate  Constructors from Superclass...

public Book() {

}

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值