GregorianCalendar isSet(int) in Java

isSet(int): This method is available in java.util.GregorianCalendar class of Java.

Syntax:

boolean java.util.Calendar.isSet(int field)

This method takes one argument of type int as its parameter. This method determines if the given calendar field has a value set.

Parameters: One parameter is required for this method.

field: the calendar field to test.

Returns: true if the given calendar field has a value set; false otherwise.

Exceptions: NA

Approach

Java

import java.util.GregorianCalendar;

public class GregorianCalendarisSet {
    public static void main(String[] args) {

        GregorianCalendar cal = new GregorianCalendar();

        int field = 1;

        System.out.println(cal.isSet(field));
    }
}

Output:

true


No comments:

Post a Comment