File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Customer Requirements for Developers this week in the Jobs Discussion 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-Urankar
Ranch Hand

Joined: Nov 25, 2007
Posts: 136
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-Urankar
Ranch Hand

Joined: Nov 25, 2007
Posts: 136
Ok.

I got how I can use abstract class with private constructor.
Where we will use this type of constructors?
 
wood burning stoves
 
subject: private constructor in abstract classes
 
It's not a secret anymore!