Formula to calculate cube Volume - Android java.lang

Android examples for java.lang:Math Formula

Description

Formula to calculate cube Volume

Demo Code


import java.text.DecimalFormat;

public class Main{
    private static double result;
    public static double cubeVolume(double side)
            throws InvalidInputException {
        if (side >= 0) {
            result = side * side * side;
            return result;
        } else {/*from w  ww.  j a  v  a  2 s  .co  m*/
            throw new InvalidInputException();
        }
    }
}

Related Tutorials