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