int num = -5; int absoluteValue = Math.abs(num); System.out.println(absoluteValue); // Output: 5
double num = -2.75; double absoluteValue = Math.abs(num); System.out.println(absoluteValue); // Output: 2.75Since Math.abs() is part of the java.lang package, it doesn't require any additional library import.