?? circle.java
字號:
/**
* Description:
* <br/>Copyright (C), 2005-2008, Yeeku.H.Lee
* <br/>This program is protected by copyright laws.
* <br/>Program Name:
* <br/>Date:
* @author Yeeku.H.Lee kongyeeku@163.com
* @version 1.0
*/
public class Circle extends Shape
{
private double radius;
public Circle(String color , double radius)
{
super(color);
this.radius = radius;
}
public void setRadius(double radius)
{
this.radius = radius;
}
//重寫Shape類的的計算周長的抽象方法
public double calPerimeter()
{
return 2 * Math.PI * radius;
}
//重寫Shape類的的返回形狀的抽象方法
public String getType()
{
return getColor() + "圓形";
}
public static void main(String[] args)
{
Shape s1 = new Triangle("黑色" , 3 , 4, 5);
Shape s2 = new Circle("黃色" , 3);
System.out.println(s1.getType());
System.out.println(s1.calPerimeter());
System.out.println(s2.getType());
System.out.println(s2.calPerimeter());
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -