public class Rectangle{
int length;
int width;
public void getArea(){
System.out.println(length * width);
}
public void getper(){
System.out.println((length + width)*2);
}
public void showAll(){
System.out.println(length * width);
System.out.println("长是" + length);
System.out.println("宽是" + width);
System.out.println("面积是");
getArea();
System.out.println("周长是");
getPer();
}
}
import java.util.Scanner;
public class Demon3.{
public staitc void main(String[] args){
Rectangle mhl = new Rectangle(); //连接
Scanner p=new Scanner(System.in) //控制台输入
System.out.print("请输入长");
mhl.length = input.nextInt();
System.out.print("请输入宽:");
mhl.with=input.nextInt();
mhl.showAll();
}
}