Open In App
Related Articles

Java | Inheritance | Question 4

Improve Article
Improve
Save Article
Save
Like Article
Like

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/ and https://www.geeksforgeeks.org/comparison-of-inheritance-in-c-and-java/

Quiz of this Question

Feeling lost in the vast world of Backend Development? It's time for a change! Join our Java Backend Development - Live Course and embark on an exciting journey to master backend development efficiently and on schedule.
What We Offer:
  • Comprehensive Course
  • Expert Guidance for Efficient Learning
  • Hands-on Experience with Real-world Projects
  • Proven Track Record with 100,000+ Successful Geeks

Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Similar Reads