Java Math multiplyFull() Method
The multiplyFull() method of Math class returns the exact product of the arguments.
Syntax:
public static long multiplyFull (int x, int y)
Parameters:
The parameters ‘x’ and ‘y’ represent the first value and second value.
Return Value:
The multiplyFull () method returns the exact mathematical product of x and y.
Example 1:
public class JavaMathMultiplyFullExample1 {
public static void main(String[] args) {
int a = 34;
int b= 45;
//returns the exact product of the arguments
System.out.println("Product of "+a+" and "+ b+ " is : "+Math.multiplyFull(a,b));
}
}
Output:
Product of 34 and 45 is : 1530
Example 2:
public class JavaMathMultiplyFullExample2 {
public static void main(String[] args) {
int a = 0/0;
int b= 1;
//returns an exception is the either argument is divided by zero
System.out.println("Product of "+a+" and "+ b+ " is : "+Math.multiplyFull(a,b));
}
}
Output:
Exception in thread "main" java.lang.ArithmeticException: / by zero at com.TutorialsAndExample.JavaMathMultiplyFullExample2.main (JavaMathMultiplyFullExample2.java:5)
