// // example using Calendar, DateFormat classes // import java.text.DateFormat ; import java.util.Calendar ; public class TestCal { public static void main(String[] args) { System.out.println("Enter date as 3 integers " + "(month day year, year in 4-digit format)") ; int month = Input.readInt() ; int day = Input.readInt() ; int year = Input.readInt() ; System.out.println("Enter number of years to show") ; int N = Input.readInt() ; // create a date formatter to print date only (no time) // in full format DateFormat df = DateFormat.getDateInstance(DateFormat.FULL) ; // create a default calendar object (default for this // locale) and set specified date Calendar cal = Calendar.getInstance() ; cal.set(year, month-1, day) ; while (N > 0) { // get date specified by calendar, format, // and print System.out.println(df.format(cal.getTime())) ; // advance calendar one year cal.add(Calendar.YEAR, 1) ; N-- ; } } }