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 What to do ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What to do ??" Watch "What to do ??" New topic
Author

What to do ??

Kumar Navin
Ranch Hand

Joined: May 27, 2004
Posts: 52
Dear Friends,
I have to fulfill two conditions while defining the class-
1) I don't want my class to be extended.
2) I don't want anyone to instantiate my class.
How do I do that as a class cannot be abstract and final at the same time.
Thanks.

-Navin.
arnel nicolas
Ranch Hand

Joined: Dec 16, 2003
Posts: 149
How about making the constructor of your class private.
Beny Na
Ranch Hand

Joined: May 26, 2004
Posts: 159
hehe..yes..making the contructor as private as Arnel said.

good reply Nicholas..
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
and mark the class itself as final.


42
 
GeeCON Prague 2014
 
subject: What to do ??