The Java interface design FAQ covers multiple inheritance, marker interfaces and interface constants and shows how a programming interface can improve concrete and abstract classes.
What if you were One Percent Better with Java interface design?
* You seek interface design opportunities, not hide from them
* You stop wasting time with fanciful inheritance schemes
* Marker interfaces hold no fear, Serializable is your friend
* You stop sweating multi-inheritance and blend behaviours like cocktails
* You cast and pass interface types like a warm knife through butter
* You enlighten friends with the simplicity of your interfaces
What's inside the Java interface design ebook?
* 33 core Java interface design questions and answers
* 10 extra Java interface design answers from other FAQs
The Java interface design FAQ ebook helps you solve Java design questions like these.
Why use interfaces to develop Java applications?
Don't spend ages adding new features to your apps, use a Java interface or two.
* I still don't get why I should use interfaces!
* How come methods in interfaces are not defined?
* What is the difference between abstract classes and interfaces?
* What's the difference between an interface and an API?
* Is an API a help document?
Where should I use interfaces in my application?
Move beyond Java toolkit interfaces and write your own Java interfaces.
* When should I use an interface?
* When should I use abstract classes rather than interfaces?
* Can you give an example of multiple inheritance with interfaces?
* What are the rules for passing subclasses for method arguments?
How to define an interface
Can an interface be declared final?
If you write an interface like a standard class, you may have missed the point of Java interfaces.
* Should I use a public access modifier for interface methods?
* Non-public modifiers can be used for nested interfaces!
* Can we create a Java class inside an interface?
* Can an interface extend a class?
* Can an interface extend an abstract class?
How to implement an interface
* Can we create an object for an interface?
* How is the implements keyword different from extends?
* Can you show how to implement an interface?
* This code seems to be instantiating an interface!
* What if two interface methods clash in implementation?
* What is a marker interface?
* How do marker interfaces affect the behaviour of classes?
* Are there any marker interfaces that have methods?
* Why do we need to implement the Serializable interface?
* Can you show an example marker interface?
* Why are interface variables public static final?
* Do interfaces have member variables?
* Interface variables can be overridden, right?
* This interface variable is assigned in a constructor!
* What style should I use to declare a member variable in an interface?
* Is this interface constant declaration correct?
Extra Java interface design questions
This ebook includes 10 extra Java interface design-related answers from six other Java FAQs.
* Can I achieve multiple inheritance without interfaces?
* Can you show examples of Java inheritance?
* Is multiple interface inheritance better than extending a class?
* Why doesn't Java support multiple inheritance?
* What Java types are available?
* What part of memory is used for interfaces and abstract classes?
* How can I cast an unknown sub-class returned by newInstance()?
* Why use an abstract class instead of an interface?
* What is a concrete object?
* How should I use visibility modifiers with interfaces?