内部类Java中的非法静态声明

时间:2014-03-24 02:57:33

标签: java printing static declaration

public class Box
{
// Instance Variables
double length ,ipsos,size ;
double width ,mikos ;
double height ,platos;
double varos;
// Constructors
 public Box ( double side )
{
width = side ;
height = side ;
length = side ;
}
public Box ( double x , double y , double z)
{
    platos = y ;
ipsos = z;
mikos = x ;

}

// Methods
double calculate(double praksi)
{
return 2 * ( width * height +
width * length +
height * length ) ;
}
double volume(double emvadon)
{
return platos*ipsos*mikos ;
}

@Override
public String toString() {
    return "Volume: " + volume(1) + "\n Calculate: " + calculate(1);
}
public class Cube extends Box {
    public Cube(double side) {
        super(side, side, side);
        if (side<0) { System.out.println("lathos timi");} 
    }

public void calculate2(double z )
{super.calculate( z  );}
public void volume2(double y)
{super.volume( y );}
@Override
public String toString() {
    return "Volume: " + super.volume(1) + "\n Calculate: " + super.calculate(1);
}


}
public class Spirtokouto extends Box {
    public Spirtokouto(double side) {     

        super(side, side, side);
        double weight;


    }
public void Spirtokouto2 (double x, double y,double z,double v)
{
mikos = x ;
platos = y;
ipsos = z;
varos = v;

}
public String toString() {
    return "Volume: " + volume(1) + "\n Calculate: " + calculate(1) + "\n Varos : " + varos;
}

public class RunMe 
{ 
    public static void main (String[]args)
    { Box b1=new Box (2.5 , 3.0, 4.0);
        System.out.println(b1.size);}

}   } }

非常抱怨大代码 但我真的很困惑,我不知道我不应该把... 所以,我想打印我给出的值,但它说:内部类中的非法静态声明。 有什么问题?

0 个答案:

没有答案