Open In App

Java | Inheritance | Question 4

Which of the following is true about inheritance in Java?


1) Private methods are final.
2) Protected members are accessible within a package and 
   inherited classes outside the package.
3) Protected methods are final.
4) We cannot override private methods. 

(A) 1, 2 and 4
(B) Only 1 and 2
(C) 1, 2 and 3
(D) 2, 3 and 4

Answer: (A)
Explanation: See https://www.geeksforgeeks.org/can-override-private-methods-java/amp/ and https://www.geeksforgeeks.org/comparison-of-inheritance-in-c-and-java/amp/
Quiz of this Question

Article Tags :