用java定义一个正方形,在main方法中调用该方法
展开全部
public class zfx {
private double x;
public zfx() {
super();
}
public zfx(double x) {
super();
this.x = x;
}
@Override
public String toString() {
return "zfx 芹巧含[x=" + x + "]";
}
public double getX() 嫌笑{
return x;
}
public void setX(double x) {
this.x = x;
}
public static void main(String[] args) {
// 宽喊TODO Auto-generated method stub
zfx z = new zfx();
z.setX(2);
System.out.println(z.toString());
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询