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