class Rectangle{
float length;
float width;
float area(){
return length*width;
}
float p(){
return (length+width)*2;
}
}
public class Jpro3_1
{
public static void main (String args[]){
Rectangle r1=new Rectangle();//创建对象
length=20f;
width=30f;
System.out.println("矩形的周长是:"+p);
System.out.println("矩形的面积是:"+area);
}
}
浮云间
慕容3067478
相关分类