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) {
        LocalTime time = LocalTime.of(15, 30, 23, 234); // 15:30:00
        System.out.println(time.getHour()); // 15
        System.out.println(time.getMinute()); // 30
        System.out.println(time.getSecond()); // 23
        System.out.println(time.getNano()); // 234
        System.out.println(time.toSecondOfDay()); // 55823
        System.out.println(time.toNanoOfDay()); // 55823000000234
    }
}