java.lang.Math.abs(float a)


java.lang.Math.abs(float a)

package com.codingdict;



import java.lang.*;



public class MathDemo {



   public static void main(String[] args) {



      // get some floats to find their absolute values

      float x = 1.2345f;

      float y = -857.54f;



      // 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(-145.0f)=" + Math.abs(-145.0f));

   }

}