Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.time.Instant;
import java.time.temporal.ChronoUnit;

public class Main {

    public static void main(String[] args) {
        // Instant is useful for generating a time stamp to represent machine time.
        Instant timestamp = Instant.now();

        // How many seconds have occurred since the beginning of the Java epoch.
        long secondsFromEpoch = Instant.ofEpochSecond(0L).until(Instant.now(), ChronoUnit.SECONDS);

        System.out.println(secondsFromEpoch);
    }
}