Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {

    public static void main(String[] args) {

        long l1 = 12345678909876L, l2 = -12345678909876L;

        // returns the absolute value of positive long value
        long lAbsValue = StrictMath.abs(l1);
        System.out.println("absolute value of " + l1 + " = " + lAbsValue);

        // returns the absolute value of negative long value
        lAbsValue = StrictMath.abs(l2);
        System.out.println("absolute value of " + l2 + " = " + lAbsValue);
    }
}