Online Java Compiler By
JavaTpoint.com
import java.math.BigInteger; public class BigIntegerEqualsExample{ public static void main(String[] args){ // create 2 BigIntegerobject BigInteger big1,big2; // assign values to big1,big2 big1= new BigInteger("111"); big2= new BigInteger("111"); // create 2 booleanobjects Boolean b1,b2; // compare big1 with big2 b1= big1.equals(big2); // compare big1 with an object value 111, which is not a bigInteger b2 =big1.equals("111"); String str1=big1+ " equals BigInteger "+big2+" is "+ b1; String str2=big1+ " equals object value 111 is" + b2; System.out.println(str1); System.out.println(str2); } }
Output