Java Program For Find Volume of a Box

class Box
{
 double width;
 double height;
 double depth;

 void volume()
 {
 System.out.print(" Volume is ");
 System.out.println(width *height*depth);
 }
}

class BoxDemo
{
public static void main(String args[])
{
Box mybox1= new Box();
Box mybox2= new Box();

mybox1.width=10;
mybox1.height=20;
mybox1.depth=15;

mybox2.width=3;
mybox2.height=6;
mybox2.depth=9;

mybox1.volume();
mybox2.volume();
}
}
Bhanu Namikaze

Bhanu Namikaze is an Ethical Hacker, Web Developer, Student and Mechanical Engineer. He Enjoys writing articles, Blogging, Solving Errors and Social Networking. Feel Free to let me know any of your concerns about hacking or let me know if you need any more methods on hacking anything. Enjoy Learning

No comments:

Post a Comment