
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java multiplyExact() in Math
It is a built-in function in Java, that is used to multiply the two values that are passed as arguments to the function. Here’s an example −
Example
import java.lang.Math; public class Demo{ public static void main(String args[]){ int a = 12, b = 34; System.out.printf("Product is : "); System.out.println(Math.multiplyExact(a, b)); long c = 78, d = 93; System.out.printf("Product is : "); System.out.println(Math.multiplyExact(c, d)); } }
Output
Product is : 408 Product is : 7254
A class named Demo contains the main function. Here, two variables are defined, and their product is calculated using the ‘multiplyExact’ function. Now two long integers are defined and again, their product is computed using the ‘multiplyExact’ function. Next, they are printed on the console.
- Related Questions & Answers
- Math class methods in Java Programming
- Math operations for BigDecimal in Java
- Math Operations on BigInteger in Java
- Static import the Math Class Methods in Java
- Math Class in C#
- Math class methods in C#
- Math. fround() function in JavaScript
- Math. hypot() function in JavaScript
- JavaScript Math Object example
- What is math object in JavaScript?
- What are JavaScript Math Functions?
- Use static Import for sqrt() and pow() methods in class Math in Java
- Math Class Fields with Examples in C#
- What is Math Object in JavaScript Program?
- How To Do Math With Lists in python ?
Advertisements