Brian

7%
Flag icon
As a side effect, this idiom also prevents the class from being subclassed. All constructors must invoke a superclass constructor, explicitly or implicitly, and a subclass would have no accessible superclass constructor to invoke.
Brian
Hadn’t thought about that benefit of private constructor. But isn’t final class offering same thing?
Effective Java
Rate this book
Clear rating
Open Preview