Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.math.BigInteger;

public class Main {

    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);
        System.out.println(b2);
    }
}