Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {
    public static void main(String[] argv) throws Exception {
        long start = System.currentTimeMillis();

        Thread.sleep(2000);

        // Get elapsed time in milliseconds
        long elapsedTimeMillis = System.currentTimeMillis() - start;

        // Get elapsed time in hours
        float elapsedTimeHour = elapsedTimeMillis / (60 * 60 * 1000F);
        System.out.println(elapsedTimeHour);
    }
}