decrementExact(x: Int)
is a function in the Math
package of Scala that decreases the argument by 1 and returns it.
def decrementExact(x: Int): Int
The function takes in one parameter, x
, of type int
.
The decrementExact()
function returns the value of x
decreased by 1, i.e., .
The function throws
ArithmeticException
ifint
is overflowed by the return value.
object MainObject {def main(args: Array[String]): Unit = {var x : Int = 130;println("Math.decrementExact(x) = " + Math.decrementExact(x));}}