Question 1240 – Nielit STA [02-12-2018]
December 10, 2023Question 1246 – Nielit STA [02-12-2018]
December 10, 2023Question 1241 – Nielit STA [02-12-2018]
Which of the following is FALSE about inheritance in Java?
Correct Answer: C
Question 21 Explanation:
→ Methods declared public in a superclass must also be public in all subclasses (this, by the way, is the reason most of the applet methods are public).
→ Methods declared protected in a superclass must either be protected or public in subclasses; they cannot be private.
→ Methods declared private are not inherited and therefore this rule doesn’t apply.
→ Methods declared without protection at all (the implicit package protection) can be declared more private in subclasses.
→ Methods declared protected in a superclass must either be protected or public in subclasses; they cannot be private.
→ Methods declared private are not inherited and therefore this rule doesn’t apply.
→ Methods declared without protection at all (the implicit package protection) can be declared more private in subclasses.
Private methods are final
Protected members are accessible within a package and inherited classes outside the package
Protected methods are final
We cannot override private methods
Subscribe
Login
0 Comments