equals(): This method is available in java.math.BigInteger class of Java.
Syntax:
boolean java.math.BigInteger.equals(Object x)
This method takes one argument of the type Object of BigInteger class. It compares this BigInteger with the specified Object for equality.
Parameters: One parameter is required for this method.
x: Object to which this BigInteger is to be compared.
Returns: true if and only if the specified Object is a BigInteger whose value is numerically equal to this BigInteger.
For Example:
BigInteger bigInteger = new BigInteger("1234")
BigInteger object = new BigInteger("1234")
bigInteger.equals(object) = > It returns true.
Approach
Java
import java.math.BigInteger;public class BigIntegerequals {public static void main(String[] args) {BigInteger bigInteger = new BigInteger("1234");BigInteger object = new BigInteger("1234");System.out.println(bigInteger.equals(object));}}
Output:
true
No comments:
Post a Comment