This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
package jichuti;
/**
* 正方形类(实现Shape接口)
*/
public class Square implements Shape {
private String color; // 颜色
private double side; // 边长
public Square(String color, double side) {
this.color = color;
this.side = side;
}
@Override
public String getColor() {
return color;
public double getArea() {
return side * side; // 正方形面积=边长×边长
// getter和setter
public double getSide() { return side; }
public void setSide(double side) { this.side = side; }