⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cylinder.txt

📁 一个比较好的Java试验
💻 TXT
字号:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package testcylinder;

/**
 *
 * @author Administrator
 */
class Circle{
    private double radius;
    public Circle(){
        radius=1.0;
    }
    public Circle(double radius){
        this.radius=radius;
    }
    public void setRadius(double radius){
        this.radius=radius;
    }
    public double getRadius(){
        return radius*radius*Math.PI;
    }
}
class Cylinder extends Circle{
    private double length;
    public Cylinder(){
        setRadius(1.0);
        length=1.0;
    }
    public Cylinder(double radius,double length){
        super(radius);
        this.length=length;
    }
    public double getArea(){
        return getArea()*length;
    }
}
public class TestCylinder{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Cylinder a=new Cylinder();
        System.out.println("The volumn is:"+a.getArea());
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -