Online Java Compiler By
JavaTpoint.com
public class AbsExample2 { public static void main(String args[]) { double x = -47.63; double y = -894.37; //print the absolute value of double type System.out.println(Math.abs(x)); System.out.println(Math.abs(y)); System.out.println(Math.abs(7.0 / 0)); } }
Output