Calendar.isSet(int field) has the following syntax.
public final boolean isSet(int field)
In the following code shows how to use Calendar.isSet(int field) method.
//from ww w . jav a 2 s . c om import java.util.Calendar; public class Main { public static void main(String[] args) { Calendar cal = Calendar.getInstance(); boolean b = cal.isSet(Calendar.DAY_OF_MONTH); System.out.println("Day of month is set: " + b); // clear day of month cal.clear(Calendar.DAY_OF_MONTH); // determine if the given calendar field has a value set b = cal.isSet(Calendar.DAY_OF_MONTH); System.out.println("Day of month is set: " + b); } }
The code above generates the following result.