wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes private constructor in abstract classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "private constructor in abstract classes" Watch "private constructor in abstract classes" New topic
Author

private constructor in abstract classes

minal silimkar
Ranch Hand

Joined: Nov 25, 2007
Posts: 133
I tried to create private constructor in abstract classes.
It is allowing.

What is the use of private condtructors in absract claases?


Minal Silimkar
Kishore Kumar
Ranch Hand

Joined: Oct 15, 2007
Posts: 71
abstract class can have a private constructor. But that class cannot be extended by another class. Instead add a static inner class inside the abstact class and extend that abstract class.



This is a small sample code.
minal silimkar
Ranch Hand

Joined: Nov 25, 2007
Posts: 133
Ok.

I got how I can use abstract class with private constructor.
Where we will use this type of constructors?
 
Don't get me started about those stupid light bulbs.
 
subject: private constructor in abstract classes
 
Similar Threads
Extendable, but not instantiatable
abstarct class can have constructor?
abstract classes with private constructor
abstract classes
What good is a class if its abstract and has a private constructor