+ 7

How can we restrict inheritance for a class?

24th Oct 2017, 7:10 PM
Chandrakant More
Chandrakant More - avatar
2 Answers
+ 7
We can prevent inheritance with keyword final. For example: public final class Person { }
24th Oct 2017, 7:35 PM
Alice
Alice - avatar
+ 4
Private data and methods can't be seen in subclasses.
24th Oct 2017, 9:57 PM
John Wells
John Wells - avatar