Calendar.YEAR has the following syntax.
public static final int YEAR
In the following code shows how to use Calendar.YEAR field.
import java.util.Calendar; // ww w .j a v a2s .c om 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: