import java.util.Calendar; import java.text.DateFormat; import java.util.Date; /** * ExampleFive shows example of the use of Calendar, Date, and DateFormat objects. */ public class ExampleFive { public static void main( String[] args) { AccountInformation ai = new AccountInformation( 100, 201, 100, 1, new Date()); // Create a calendar instance: Calendar greg = Calendar.getInstance(); // Set the value of the calendar to Feb 28, 2007 greg.set( 2007, Calendar.FEBRUARY, 28); // Get the Date object corresponding to the above value Date gregsTime = greg.getTime(); // Use this date object // Print out this time with a DateFormat object DateFormat aFormatter = DateFormat.getDateInstance(); System.out.println( aFormatter.format( gregsTime)); // Create an account information object with a Date object set at the end of // the year, 2005: greg.set( 2005, Calendar.DECEMBER, 31); AccountInformation anotherInfo = new AccountInformation( 1000, 2002, 0, 0.2, greg.getTime()); // Print out the date of anotherInfo: System.out.println( aFormatter.format( anotherInfo.getDateStamp())); } }