public class Rectangle {
int length;
int width;
public int getArea(){
int area;
area = length * width;
return area;
}
public int getPer(){
int per;
per = 2*(length + width);
return per;
}
void showAll(){
System.out.println("长为"+length+",宽为"+width+",面积为"+getArea()+",周长为"+getPer());
}
public Rectangle(int width,int length){
this.length = length;
this.width = width;
}
}
public static void main(String[] args) {
Rectangle rc = new Rectangle(2,3);
rc.showAll();
}