Tuesday, 14 February 2017

Math : abs()



public class abs {

    public static void main (String[] args)
    {
        // --- double        double d1 = -569.55;        System.out.println(" double : "+Math.abs(d1));
        // --- float        float f1 = -500.55f;        System.out.println(" float : "+Math.abs(f1));
        // --- int        int i1 = -555;        System.out.println(" int : "+Math.abs(i1));
        // --- long        long l1 = -569l;        System.out.println(" long : "+Math.abs(l1));

    }
}

No comments:

Post a Comment