The decrementExact() method of Math class returns the argument which is decremented by one, throwing an exception is the result overflows an int or long.


public static int decrementExact (int a)


The parameter ‘a’ represents the value to decrement.

Return Value:

The decrementExact () method returns the result after decrementing the value.


The decrementExact () method throws:

ArithmeticException- if the result overflows an int or a long

 Example 1:


Example 2:


Example 3:


Example 4:


Pin It on Pinterest

Share This