Link to home
Start Free TrialLog in
Avatar of hank1
hank1

asked on

instance of an abstract class

take Calendar

On the API page it is described as an abstract class, yet you
obtain it with it's static getInstance method.  Please explain.
Everywhere I turn instructors say you can not get an object
of an abstract class.  Does getInstance build something else?,
something which extends Calander?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>Does getInstance build something else?,
something which extends Calander?

Yes
Usually GregorianCalendar:

System.out.println(Calendar.getInstance().getClass());
Avatar of hank1
hank1

ASKER

So you can call static methods of abstract classes.
THis, and who know why, also works Cal.. c = new Cal...()

I didn't think you could do that either.

Thanks
:-)

>> So you can call static methods of abstract classes.

yes

>>THis, and who know why, also works Cal.. c = new Cal...()

No it won't compile