Sunday, 13 November 2016

Java Program to find the Volume of a Box

Volume of a Box in Java


                  The below program demonstrates simple class creation and perform volume calculation of a box.


Program:


class Box {
double width;
double height;
double depth;
}
public class BoxJavaProgram {
    public static void main(String[] args){
        Box mybox = new Box();
        double vol;
        mybox.width = 20;
        mybox.height = 30;
        mybox.depth = 10;
        vol = mybox.width * mybox.height * mybox.depth;
        System.out.println("Volume is " + vol);
    }
}

Output:


Volume is 6000.0

18 comments :

  1. Java training institute in Bangalore Uttarainfo offers excellent Java training,covering the entire spectrum to make understand the Modules better using the newest version of the software
    http://www.uttarainfo.com/java-training-institute-in-bangalore.php

    ReplyDelete
  2. Great article, really very helpful content you made. Thank you, keep sharing.

    Internet Of Things Services | Austere Technologies

    ReplyDelete
  3. Very good informative article. Thanks for sharing such nice article, keep on up dating such good articles.

    Digital Transformation Services | Austere Technologies

    ReplyDelete
  4. Looking so informative, thanks much for sharing the useful article keep posting on...
    Best Online Software Training Institute | Java Online Training

    ReplyDelete
  5. Great article, really very helpful content you made. Thank you, keep sharing.

    No 1 Commerce College in Hyd | Avinash college of commerce

    ReplyDelete
  6. Thank you for sharing this valuable information. But get out this busy life and find some peace with a beautiful trip. book best Andaman honeymoon packages

    ReplyDelete
  7. Hi Thanks for the nice information its very useful to read your blog. We provide best financial education

    ReplyDelete
  8. top architects in chennai

    Architects and Interior Designers make your home look marvelous. They bring to you, your dream home. Here are top architects in Chennai that you look for

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Nice Post. Keep up the Good work. Private Online Java Tutor | www.javatutoronline.com

    ReplyDelete