数组越界啦~
你的a太短咯~

解决方案 »

  1.   

    咯咯~~~谢谢!!!
    我还有个问题唉:
    interface figure
    {
    double half=0.5, pi=3.14159;     
    void parameter();                
    void area();
    }class triangle implements figure
    {
    double b, h;
    triangle(double u, double v){b=u; h=v; }
    public void parameter(){System.out.print("底边" +b+ "高" +h); }
    public void area(){System.out.println("三角形面积: " +half*b*h); } 
    }
    class retangle implements figure
    {
    double w, h;
    retangle(double u, double v){w=u; h=v; }
    public void parameter(){System.out.print("宽度: " +w+ "高度: " +h); }
    public void area(){System.out.println("矩形的面积: " + w*h); }
    }
    class  jex713
    {
    public static void main(String[] args) //throws IOException
    {
    triangle tt = new triangle(2, 3);
    retangle rr = new retangle(4, 5);
    figure[] figureSet = {tt, rr};    
    for(int i=0; i<figureSet.length; i++){
                  figureSet[i].parameter();
         figureSet[i].area();
    }
    }
    }
    最上面那个接口独立编译是通过的,可运行也和整个程序运行出一样的问题:
    运行时:Exception in thread "main" java.lang.NoClassDefFoundError: jex73