Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.time.LocalTime;

public class Main {
    public static void main(String[] args) {
        // current
        LocalTime localTime1 = LocalTime.now();
        System.out.println(localTime1);
        // 09:30
        LocalTime localTime2 = LocalTime.of(9, 30);
        System.out.println(localTime2);
        // 09:30:50
        LocalTime localTime3 = LocalTime.of(9, 30, 50);
        System.out.println(localTime3);
        // 09:30:50.000005678
        LocalTime localTime4 = LocalTime.of(9, 30, 50, 5678);
        System.out.println(localTime4);
    }
}