Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Calendar;

public class Main {

    public static void main(String[] args) {

        Calendar cal = Calendar.getInstance();

        // get the time in milliseconds
        System.out.println("Current time is :" + cal.getTime());

        // set time to 5000000000 ms after january 1 1970
        cal.setTimeInMillis(5000000000L);

        // print the new time
        System.out.println("After setting Time:  " + cal.getTime());
    }
}