|
-
December 27th, 2004, 12:36 PM
#1
Senior Member
basic doubt
Hello guys i have some very basic doubt in java class, i was just playing with the very simple and basic.
what i was trying to do it to create the object of a class "Boxers" inside itself and then using the object, i was try to call the method of the class. but it was not working.
Can anyone et me know where am i going wrong, or what am i not following. any sort of information will be appreciated. the following is the code.
-----------------------------------------------------------------------------------------------------------------
class Boxers
{
public static void main(String args[])
{
double width=0.0;
double height=0.0;
double depth=0.0;
Boxers box1=new Boxers();
Boxers box2=new Boxers();
box1.width=27;
box1.height=23;
box1.depth=43;
box2.width=21;
box2.height=24;
box2.depth=32;
box1.volume();
box2.volume();
void volume()
{
System.out.println("the volume of the box is: "+(width*height*depth));
}
}
}
-------------------------------------------------------------------------------------------------------------------
Thanks regrads
Harbir
U get What U pay for. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|