Constructor error in JAVA ?
class box
{
int height;
int width;
int length;
box(int h=0, int w=0, int l=0)
{
height=h;
width=w;
length=l;
}
int vol()
{
return height*width*length;
}
}
public class consdemo
{
public static void main(String[] args)
{
box b1=new box(44,55,66);
int volume;
volume=b1.vol();
System.out.println(volume);
}
}
{
int height;
int width;
int length;
box(int h=0, int w=0, int l=0)
{
height=h;
width=w;
length=l;
}
int vol()
{
return height*width*length;
}
}
public class consdemo
{
public static void main(String[] args)
{
box b1=new box(44,55,66);
int volume;
volume=b1.vol();
System.out.println(volume);
}
}
0