例题:
代码:
我们可以使用快捷键:
1、选中constructor
2、选择下方的select none
表示什么都不选,则出现一个空参:
3、按住shift点击最下面的,全选之后,(或者ctrl+A)创造有参构造:
4、创造set get方法:
插件步骤:
file->settings
点击install,安装即可:
右键点击空白处:
点击之后发现,将空参构造,有参构造,set get方法全部创建了出来
自己练习:
import java.sql.SQLOutput; public class hello { public static void main(String[] args) { helloWorld h1= new helloWorld("bai","1234"); System.out.println(h1.getName()); System.out.println(h1.getPassword()); } }
public class helloWorld {
private String name;
private String password;
public helloWorld() {
}
public helloWorld(String name, String password) {
this.name = name;
this.password = password;
}
/**
* 获取
* @return name
*/
public String getName() {
return name;
}
/**
* 设置
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
* 获取
* @return password
*/
public String getPassword() {
return password;
}
/**
* 设置
* @param password
*/
public void setPassword(String password) {
this.password = password;
}
public String toString() {
return "helloWorld{name = " + name + ", password = " + password + "}";
}
}