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