How to calculate the volume of any cube in Java

1 Answer

0 votes
public class JavaApplication1 {
   
    public static void main(String[] args) {
 
        double v = volume(3.13, 2.76, 6.21);

        System.out.println("volume: " + v);
    }
     
    public static double volume(double length, double width, double height) {
        return length * width * height;
    }
}


/*
run:
    
volume: 53.646948
     
*/

 



answered Mar 21, 2018 by avibootz
edited Mar 21, 2018 by avibootz

Related questions

1 answer 234 views
1 answer 284 views
1 answer 510 views
1 answer 868 views
1 answer 255 views
1 answer 262 views
262 views asked Mar 20, 2018 by avibootz
1 answer 249 views
...