0
Everyone knows that if a class is declared as final then it doesn't allow inheritance. Is there any other way to restrict inheritance .?
4 Answers
+ 1
- Make all member elements and methods privateÂ
+ 1
If you make the constructor private no other class can instantiate an object from it. As subclasses also call on the constructor of the extended class, it should not be possible to do so with a private one.
0
thanks
0
put a class in a new package with no access modifier