Java Calendar YEAR
Syntax
Calendar.YEAR has the following syntax.
public static final int YEAR
Example
In the following code shows how to use Calendar.YEAR field.
import java.util.Calendar;
//from www .ja va2 s. co m
public class Main {
public static void main(String[] args) {
Calendar future = Calendar.getInstance();
future.set(Calendar.YEAR, 3010);
Calendar now = Calendar.getInstance();
System.out.println("Is futureCal after now ? : " + future.after(now));
}
}
The output:
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »