This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What to do ??
 
It's not a secret anymore!