I'm sorry....there is a mistake in the first one.... this is it.
import java.util.Date;
class Date {
public static void main(String args[]) {
String months[] = {
"Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"};
// Create a date initialized with the
// current date and time in the default
// locale and timezone.
Date calendar = Date.getInstance();
// Display current time and date information.
System.out.print("Date: ");
System.out.print(months[calendar.get(Date.MONTH)]);
System.out.print(" " + calendar.get(Date.DATE) + " ");
System.out.print(calendar.get(Date.YEAR));
System.out.println(".");
}
}
I hope this helps you.
Output will be as follows:
Date: May 5 2002.
Enjoy!