Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help a Beginner? cannot find symbol error?

807589Aug 17 2008 — edited Aug 18 2008
class Box {
double width;
double height;
double depth;


Box(Box ob) {
width = ob.width;
height = ob.height;
depth = ob.depth;
}

Box(double w, double h, double d) {
width = w;
height = h;
depth = d;
}

double volume() {
return width * height * depth;
}
}

class BoxWeight extends Box {
double weight;

BoxWeight(double w, double h, double d, double m) {
width = w;
height = h;
depth = d;
weight = m;
}
}


class DemoBoxWeight {
public static void main(String[] args) {
BoxWeight mybox1 = new BoxWeight(10, 20, 35, 34);
double vol;

vol = mybox1.volume();
System.out.println("Weight of mybox1 is " + mybox1.weight);

}
}

okay, this is basically from a book, but when I compile it in TextPad, it reads

C:\Documents and Settings\Guest 1\Desktop\EPGY C015\Box\Box.java:27: cannot find symbol
symbol : constructor Box()
location: class Box
BoxWeight(double w, double h, double d, double m) {
^
1 error

Tool completed with exit code 1

Why is that and how can I fix it? :P
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 15 2008
Added on Aug 17 2008
3 comments
207 views