java.lang.Math.abs(double a)


java.lang.Math.abs(double a)

package com.codingdict;



import java.lang.Math;



public class MathDemo {



   public static void main(String[] args) {



      // get some doubles to find their absolute values

      double x = 4876.1874d;

      double y = -0.0d;



      // get and print their absolute values

      System.out.println("Math.abs(" + x + ")=" + Math.abs(x));

      System.out.println("Math.abs(" + y + ")=" + Math.abs(y));

      System.out.println("Math.abs(-9999.555d)=" + Math.abs(-9999.555d));

   }

}