posted 14 years ago
I'm looking at the Calendar class and am a bit confused about the difference and use of the constructor Calendar() and the method getInstance() in the same class.
The constructor says "CONSTRUCTS a Calendar with the default time zone and locale."
The method says "GETS a calendar using the default time zone and locale." and returns a calendar object.
This seems very weird to me. Don't these do the same thing? I'm wondering if perhaps you are not allowed to invoke the constructor of this class. If so, why would that be the case?
The example given in the API shows ...
Calendar rightNow = Calendar.getInstance();
I would have expected something like ...
Calendar rightNow = new Calendar();
rightNow.someMethod();
Thanks for any help!