dengyinjun
发贴: 11
积分: 0
|
于 2005-05-25 03:55
interface class Shape{ double area();{ } double perimeter(){ } } class Rectangle implements Shape{ int width,height; Rectangle(double width,double length){ this.width = width; this.height = height; } public double area();{ return width*height; } public double perimeter(){ return 2*(width+height); } } class Test { public static void main(String[] args){ Shape shape = new Rectangle(4,5); System.out.println(""+shape.area()); System.out.println(""+shape.perimeter()); } } 由于在网吧里,就没有测试,...
|