Eclipse学习之快速创建构造方法和get,set方法
快捷方式在下面代码块上面
package com.heima.bean;
public class Student {
private String name;
private int age;
//空参构造
//alt+shift+s ,再点击c
public Student() {
super();
// TODO Auto-generated constructor stub
}
//有参构造
//alt+shift+s ,再点击o
public Student(String name, int age) {
super();
this.name = name;
this.age = age;
}
//set get 方法
//alt+shift+s ,再点击r
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
//重写toString
//Alt + shift + s, 再点击S
public String toString() {
return "Student [name=" + name + ", age=" + age + "]";
}
}