isSet(int): This method is available in java.util.Calendar 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.Calendar;public class CalendarisSet {public static void main(String[] args) {// create a calendarCalendar calendar = Calendar.getInstance();calendar.add(Calendar.DATE, 2);int field = 1;System.out.println(calendar.isSet(field));}}
Output:
true
No comments:
Post a Comment