我的代码如下
package com.imooc; import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("请输入圆的半径:"); double radius = input.nextDouble(); System.out.println("请输入矩形的长:"); double ll = input.nextDouble(); System.out.println("请输入矩形的宽:"); double ww = input.nextDouble(); Shape sha = new Rectangle(ll,ww); sha.Perimeter(); sha.area(); Shape sha1 = new Circle(radius); sha1.Perimeter(); sha1.area(); } }