java division int by 0 code example Example: java division int by 0 assertThrows(ArithmeticException.class, () -> { int result = 12 / 0; });