Java GregorianCalendar() Constructor

Syntax

GregorianCalendar() constructor from GregorianCalendar has the following syntax.

public GregorianCalendar()

Example

In the following code shows how to use GregorianCalendar.GregorianCalendar() constructor.


import java.util.GregorianCalendar;
//  www  . j  a v a 2  s . c  o m
public class Main {

   public static void main(String[] args) {

      GregorianCalendar cal = new GregorianCalendar();

      System.out.println(cal.getTime());
      

   }
}

The code above generates the following result.