import java.util.*;
class box
{
int h,w,d;
}
void volume()
{
System.out.println("Volume="+(w*h*d));
}
class boxdemo
{
public static void main(String arg[])
{
box b1=new box();
box b2=new box();
b1.h=10;
b1.w=20;
b1.d=30;
b2.h=20;
b2.w=30;
b2.d=40;
b1.volume;
b2.volume;
}
}
What's wrong with the code? please send me the correct code. It shows two errors saying class,interface or enum expected.
See Question&Answers more detail:os