Jesper de Jong wrote:
To make it impossible to instantiate a class (from outside the class itself), make all constructors of the class private.
Campbell Ritchie wrote:That class should only have static members.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
luck, db
There are no new questions, but there may be new answers.
ashok bantu wrote:how to make a class not to inherit and not to instantiate simultaneously
Campbell Ritchie wrote:The final declaration is redundant, but still useful to alert users to the situation.
Campbell Ritchie wrote:Yes, that was an omission of mine. Thank you. That will only happen, I presume, if the anynmous class is a nested clas in the first class
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|