Online Java Compiler By
JavaTpoint.com
public class SubtractExactExample3 { public static void main(String[] args) { long a = Long.MIN_VALUE; long b = 42; // Input long overflow, Output AirthmeticException System.out.println(Math.subtractExact(a, b)); } }
Output