Description Of BigInteger: equals(Object x)
The java.math.BigInteger.equals(Object x) compares this BigInteger with the specified Object for equalityBigInteger.equals(Object x) method returns true if and only if the specified Object is a BigInteger whose value is numerically equal to this BigInteger
Code Example Java BigInteger
import java.math.BigInteger; public class BigIntegerExam { public static void main(String[] args) { BigInteger bi1 = new BigInteger("123"); BigInteger bi2 = new BigInteger("123"); // compare bi1 with bi2 Boolean b1 = bi1.equals(bi2); // compare bi1 with an object value 123, which is not a BigIntger Boolean b2 = bi1.equals("123"); System.out.println(b1); // output true System.out.println(b2); // output false } }
ไม่มีความคิดเห็น :
แสดงความคิดเห็น