Formula to calculate square Area - Android java.lang

Android examples for java.lang:Math Formula

Description

Formula to calculate square Area

Demo Code


import java.text.DecimalFormat;

public class Main{
    private static double result;
    public static double squareArea(double side)
            throws InvalidInputException {
        if (side >= 0) {
            result = (side * side);//  w  w  w  .ja v a  2s . c  o m
            return result;
        } else {
            throw new InvalidInputException();
        }
    }
}

Related Tutorials