Vijay Tidake wrote:
Although Calender class has a abstract method getInstance(), but when you say Calendar calc=Calendar.getInstance();
calc is referring to the class instance of class GregorianCalendar as "GregorianCalendar extends Calendar "
Calendar#getInstance() is not abstract, it is static. Two different things. The Calendar
class is abstract.
Vijay Tidake wrote:
calc is referring to the class instance of class GregorianCalendar as "GregorianCalendar extends Calendar "
Not always. As quoted from the API
Doc
Gets a calendar using the default time zone and locale.
If you actually look at the comment in the code snippet you posted, it can also return the Buddhist and JapaneseImperialCalendar which are not Gregorian