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