为什么这里错误
package java1;public abstract class Shape {
{
System.out.println("执行Shaps的初始会");
}
private String color;
public abstract double calPerimeter();
public abstract String getType();
public Shape(){}
public Shape(String color)
{
System.out.println("执行Shaps的初始构造器。。。");
this.color=color;
}
public class Triangle extends Shape
{
private double a;
private double b;
private double c;
public Triangle(String color ,double a , double b , double c)
{
if(a>=b+c||b>=a+c||c>=a+b)
{
System.out.println("三角型两边之和必须大于第三班");
return;
}
this.a=a;
this.b=b;
this.c=c;
}
public double calPerimeter()
{
return a+b+c;
}
public String getType()
{
return "三角形";
}
}
public static class Circle extends Shape
{
private static final Shape sl = null;
private double radius;
public Circle (String color,double radius )
{
super(color);
this.radius =radius;
}
public void setRandius(double radius)
{
this.radius =radius;
}
public double calPerimete()
{
return 2 * Math.PI *radius;
}
public String getType()
{
return getColor() +"圆形";
}
private String getColor() {
// TODO 自动生成的方法存根
return null;
}
@SuppressWarnings("null")
public static void mani(String[] args)
{
Shape s1 = new Triangle("黑色",3,4,5);
------------------------->报错
Shape s2 = new Circle("黄色",3);
System.out.println(sl.getType());
}
@Override
public double calPerimeter() {
// TODO 自动生成的方法存根
return 0;
}
}
} // TODO 自动生成的方法存根