A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
What to do ??
Joined: May 27, 2004
Jun 22, 2004 23:54:00
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.
Joined: Dec 16, 2003
Jun 23, 2004 00:00:00
How about making the constructor of your class private.
Joined: May 26, 2004
Jun 23, 2004 03:25:00
hehe..yes..making the contructor as private as Arnel said.
good reply Nicholas..
Joined: Oct 12, 2000
Jun 23, 2004 04:09:00
and mark the class itself as final.
It is sorta covered in the
JavaRanch Style Guide
subject: What to do ??
Don't want to use ActionForm only Action class
don't create too much object?
modify method in byte code using ASM.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013