Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.time.Period;

public class Main {

    public static void main(String[] args) {
        Period p = Period.ofDays(30);
        System.out.println(p);

        Period p1 = Period.ofMonths(12);
        System.out.println(p1);

        Period p2 = Period.ofWeeks(11);
        System.out.println(p2);

        Period p3 = Period.ofYears(50); // years, months, days
        System.out.println(p3);
    }
}