请指点,谢谢
可还是感觉不完美
可还是感觉不完美
2018-10-22
为什么不能这样写啊
package shape;
import java.util.Scanner;
public class Rectangle extends Shape {
Scanner input = new Scanner(System.in);
System.out.println("长方形的长为:");
double longer = input.nextDouble();
System.out.println("长方形的宽为:");
double higher = input.nextDouble();
public void perimeter() {
// TODO Auto-generated method stub
double perimeter = 2*(longer+higher);
System.out.println("长方形的周长为:"+perimeter);
}
public void area() {
// TODO Auto-generated method stub
double area = longer*higher;
System.out.println("长方形的面积为:"+area);
}
}
举报