Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Filipp Uvarov767 Points
Composition vs Inheritance. The first question has wrong right answer
The statement goes like this: When you use the inheritance model of code re-use, you must implement ALL public methods provided by the parent class.
For some reason the right answer for this question is TRUE. This is not how Java works, you do not have to implement ALL public methods of a parent class unless parent class is an interface or an abstract class ALL of which methods are abstract.
Ignazio CaloCourses Plus Student 1,819 Points
I din't take this class, but from your explanation I would say that yes, you're right a JAVA subclass doesn't need to implement method of a superclass.
The only thing that comes to my mind, considering that we are talking about code re-use, is that maybe the author doesn't mean "literarily" implement but he's talking about the fact that in a subclass you "cannot remove" a method implemented in a superclass. Of course you can override with an empty implementation, but there is no way that your subclass can "do not implement". a method defined into a superclass.