| Author |
calendar.getInstance()
|
sivaramp pratapa
Greenhorn
Joined: Jul 05, 2003
Posts: 11
|
|
Hi calendar.getInstance() returns a calendar object, why is that! calendar is an abstract class.. so, where from this returns a calendar object! can you guys throw some light on this! please. . thanks siva
|
 |
Alton Hernandez
Ranch Hand
Joined: May 30, 2003
Posts: 443
|
|
Hi, It is because getInstance() is a static method. Consider this code. Compile it and run it and see what happens.
|
 |
George Hill
Greenhorn
Joined: Aug 26, 2003
Posts: 6
|
|
Hi, look the java source.You will get it. /** * Gets a calendar with the specified time zone and locale. * The <code>Calendar</code> returned is based on the current time * in the given time zone with the given locale. * * @param zone the time zone to use * @param aLocale the locale for the week data * @return a Calendar. */ public static Calendar getInstance(TimeZone zone, Locale aLocale) { return createCalendar(zone, aLocale); } private static Calendar createCalendar(TimeZone zone, Locale aLocale) { if (aLocale.getLanguage().compareTo("th") == 0) { if (aLocale.getCountry().compareTo("TH") == 0) { return new sun.util.BuddhistCalendar(zone, aLocale); } } // else create the default calendar return new GregorianCalendar(zone, aLocale); }
|
 |
 |
|
|
subject: calendar.getInstance()
|
|
|