java - 找不到或加载mainclass Triangle1

时间:2016-02-20 05:33:42

标签: java syntax-error

我正在处理一个应用程序,我突然收到此消息错误:无法找到或加载主类triangle1。我不知道出了什么问题。如果有人能帮我弄清楚我的代码有什么问题,我会非常感激。谢谢

    public class Triangle1 extends GeometricObject {
    private double side1; 
    private double side2; 
    private double side3;

    public Triangle1(){
    } 

    public Triangle1(double side1, double side2, double side3) {
        this.side1 = side1;
        this.side2 = side2;
        this.side3 = side3;
    }

    public Triangle1(double side1, double side2, double side3, 
        String color, boolean filled) {
        this(side1, side2, side3);
        setColor(color);
        setFilled(filled); 
    }

    /** Return side1 */
    public double getSide1() {
        return side1;
    }

    /** Set side1 to a new lentgh */
    public void setSide1(double side1) {
        this.side1 = side1;
    }

    /** Return side2 */
    public double getSide2() {
        return side2;
    }

    /** Set side2 to a new lentgh */
    public void setSide2(double side2) {
        this.side2 = side2;
    }

    /** Return side3 */
    public double getSide3() {
        return side3;
    }

    /** Set side3 to a new lentgh */
    public void setSide3(double side3) {
        this.side3 = side3;
    }

    @Override /** Return area of this Triangle */
    public double getArea() {
        double s = (side1 + side2 + side3) / 2;
        return Math.sqrt(s * (s - side1) * (s - side2) * (s - side3));
    }

    @Override /** Return perimeter of this triangle */
    public double getPerimeter() {
        return side1 + side2 + side3;
    }

    @Override /** Return a string discription of the object */
    public String toString() {
        return super.toString() + "\nArea: " + getArea() + 
            "\nPerimeter: " + getPerimeter(); 
    }
}

1 个答案:

答案 0 :(得分:0)

我明白了。我在课堂上分配了错误的名字。