Calculate Volume of a 3D box using double type variables - Java Language Basics

Java examples for Language Basics:Variable

Description

Calculate Volume of a 3D box using double type variables

Demo Code

public class Main {
    public static void main(String[] args) {
        double width = 0.5, height = 1.0, depth = 0.2;

        System.out.print("Volume of the box (in cubic meter):");
        System.out.println(width * height * depth);
    }/*from   w  w  w  .  java  2s  .  c o m*/
}

Result


Related Tutorials