public class Customer {
private int custId;
private String user;
private String password;
private String name;
private String title;
private String email;
private boolean checkin=false;
public Customer(){}
public int getCustid(){return custId;}
public String getUser(){return user;}
public String getPassword(){return password;}
public String getName(){return name;}
public String getTitle(){return title;}
public String getEmail(){return email;}
public boolean getCheckin(){return this.checkin;}
}
为什么public boolean getCheckin(){return this.checkin;}要加上this,其它几个就不用this呢?谢谢!
private int custId;
private String user;
private String password;
private String name;
private String title;
private String email;
private boolean checkin=false;
public Customer(){}
public int getCustid(){return custId;}
public String getUser(){return user;}
public String getPassword(){return password;}
public String getName(){return name;}
public String getTitle(){return title;}
public String getEmail(){return email;}
public boolean getCheckin(){return this.checkin;}
}
为什么public boolean getCheckin(){return this.checkin;}要加上this,其它几个就不用this呢?谢谢!
解决方案 »
- 用div和css在html中做了个菜单,可以显示,但在jsp中不显示
- myeclipse下配置了struts2运行文件时候报出的错误
- 谁知道 hibernate annotation 3.2 or 3.3在哪里下载
- static变量的问题。
- 我想把数据库中登录的图像显示于网页,如何用在logic:iterate中设置html:img的src或page地址?
- request绑定实体类Entity的方法
- 数据排序和移动的处理方法
- 留言簿——分页显示
- json和session.setAttribute对比
- Servlet怎么获得JSP表格中复选框选中的行的所有列值
- tomcat下如何设置,让它自启动 自定义的有socket server功能的servlet
- jsp:usebean 和struts标签 有什么区别
public class Customer { private int custId; private String user; private String password; private String name; private String title; private String email; private boolean checkin = false; public Customer() { } public int getCustid() {
return this.custId;
} public String getUser() {
return this.user;
} public String getPassword() {
return this.password;
} public String getName() {
return this.name;
} public String getTitle() {
return this.title;
} public String getEmail() {
return this.email;
} public boolean getCheckin() {
return this.checkin;
}}
下面就得加!
public Customer(boolean checkin){
this.checkin = checkin;
} 我一般都加上this 因为我比较懒! 有的变量名实在是太长! this.帮助完成代码!
还有一种用法,当你用开发工具开发的时候,不记得方法名的时候 通过调用this.**来提示
public class Customer {
private String name;
public void setName(String name){
this.name = name;//这时候 这两个name 代表不同的变量 前面的那个name就代表成员变量name,后面的就传
//进来的那个name;
}
}