Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.math.BigDecimal;

public class Main {

    public static void main(String[] args) {

        BigDecimal bg1 = new BigDecimal("12.345");
        BigDecimal bg2 = new BigDecimal("20.123");

        // print bg1 and bg2 value
        System.out.println("Object Value is " + bg1);
        System.out.println("Augend value is " + bg2);

        // perform add operation on bg1 with augend bg2
        BigDecimal bg3 = bg1.add(bg2);

        // print bg3 value
        System.out.println("Result is " + bg3);
    }
}