package javase7;
public class javase7_2 {
private float height; //定义一个矩形的长
private float width; //定义一个矩形的宽
public javase7_2(float height,float width){
this.height=height;
this.width=width;
}
public float square(){
return height*width; //矩形的面积
}
public static void main(String [] args){
javase7_2 l =new javase7_2(5f,8f);
System.out.println("矩形面积:"+l.square());
}
}
版权声明:本文为QQ675396947原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。