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 Respuestas
+ 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