This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv 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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What to do ??" Watch "What to do ??" New topic

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.

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.

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: What to do ??
It's not a secret anymore!