কম্পিউটার টিউটোরিয়াল

জাভা Math.multiplyExact() মেথড


এটি জাভাতে একটি বিল্ট-ইন ফাংশন, যা ফাংশনে আর্গুমেন্ট হিসেবে পাস করা দুটি মান গুণ করতে ব্যবহৃত হয়। একটি উদাহরণ নিচে দেওয়া হলো:

উদাহরণ

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));    } }

আউটপুট

Product is : 408 Product is : 7254

Demo ক্লাসে main ফাংশন আছে। এখানে, দুটি ভেরিয়েবল সংজ্ঞায়িত করা হয়েছে, এবং তাদের গুণফল 'multiplyExact' ফাংশন ব্যবহার করে ক্যালকুলেট করা হয়েছে। এখন দুটি long ইন্টিজার সংজ্ঞায়িত করা হয়েছে এবং আবার, তাদের গুণফল 'multiplyExact' ফাংশন ব্যবহার করে কম্পিউট করা হয়েছে। এরপর, সেগুলো কনসোলে প্রিন্ট করা হয়েছে।

  1. জাভাস্ক্রিপ্টে Math.cosh() ফাংশন

  2. জাভাতে খালি ফাংশন লিখার পদ্ধতি

  3. জাভাতে Iterator বনাম Collection

  4. জাভাতে IntUnaryOperator ইন্টারফেস