【java】如何获得一个数字的绝对值 # Math.abs(-5) 获取数字的绝对值方法 System.out.println(Math.abs(5)); System.out.println(Math.abs(-5)); System.out.println(Math.abs(-5.6)); System.out.println(Math.abs(2+3)); 输出: 5 5 5.6 5