What is multiplyExact(x: Long, y: Long) in Scala?
multiplyExact(x: Long, y: Long) is a function in the math package of Scala. The function returns the product of the numbers passed in as arguments.
Syntax
def multiplyExact(x: Long, y: Long): Long
Parameters
The function takes two parameters: x and y. The parameters are of type Long.
Return value
The function returns *.
The function throws ArithmeticException if the
Longis overflowed by the return value.
Code
object MainObject {def main(args: Array[String]) {var x : Long = 31;var y : Long = 22;println("Math.multiplyExact(x, y) = " + Math.multiplyExact(x, y));}}