This edition covers inheritance keywords to design patterns with examples of multiple inheritance, how to override methods and use abstract classes for tiered call sequences.
What if you were One Percent Better with Java inheritance?
* You stop sweating multi-inheritance and blend behaviours like cocktails
* You see method call sequences crystallise before your eyes
* You cut duplicate code down to size with inheritance design patterns
* You are a power user of inheritance keywords and modifiers
* You lock-down specialist code to protect it from lesser developers
* You feel the force of abstract class design at your fingertips
What's inside the Java inheritance ebook?
* 23 core Java inheritance questions and answers
* 15 extra Java inheritance answers from other FAQs
The Java inheritance FAQ ebook helps you solve problems like these.
Can I achieve multiple inheritance without interfaces?
No matter how many abstract classes you write, you need to accept that multiple inheritance in Java needs an interface or two.
* Why doesn't Java support multiple inheritance?
* Doesn't implicit Object inheritance create multiple inheritance?
* Is multiple interface inheritance better than extending a class?
Java inheritance principles
Can you show examples of Java inheritance?
Progress from single class programs to layered Java applications when you extend a class.
* What is the difference between abstract classes and inheritance?
* What are the benefits of inheritance?
* What forms of inheritance are supported by Java?
* Isn't specialization a form of inheritance?
* How does inheritance avoid duplication?
What's the difference between importing and extending a class?
Move beyond copy and paste code and remove unnecessary import statements, you'll understand inheritance far better.
* Can we explicitly inherit from the Object class?
* How can I use inheritance in graphical user interfaces?
* How can I prevent a class from being extended?
Can you give an example application that shows overriding?
The power of a good example will show you how to get different behaviour in subclasses by overriding methods.
* What is overriding?
* Can an overridden method return void instead of an object?
* Why do overridden methods on a subclass have priority over the superclass?
* How do you prevent a method from being overridden?
* How can I find the inherited attributes of a class?
Techniques for overridden superclasses
* Can you give an example call to an overridden superclass method?
* How can I call an overridden method in the superclass?
* How can I get the superclass to call back to a method in the subclass?
Extra Java inheritance questions
This ebook includes 15 extra Java inheritance-related answers from six other Java FAQs.
* What's the use of concrete methods in abstract classes?
* How many abstract subclasses can I create?
* How can an abstract method be inherited?
* Can you give an example of an abstract class?
* Can you give an example of multiple inheritance with interfaces?
* Can an interface extend a class?
* Can an interface extend an abstract class?
* How is the implements keyword different from extends?
* Do interfaces have member variables?
* Interface variables can be overridden, right?
* What is dynamic method dispatch?
* How can I prevent inheritance without marking a class final?
* I assume inherited fields and members are non-private, are they?
* What is an object in Java?
* How do I create a Runnable with inheritance?