public class GeometricObject {
protected String color; // protected 可以被子类访问
protected double weight;
// ctrl + / 是注释多行
// ctrl + shift + / 是 注释代码块
// protected GeometricObject(String color, double weight){
// this.color = color;
// this.weight = weight;
// }
public GeometricObject(String color, double weight) {
this.color = color;
this.weight = weight;
}
// 自动生成 get 和 set 方法
// 右键 generator
// 或者是 alt + insert 快捷键
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
}