Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8864585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:16:42+00:00 2026-06-14T16:16:42+00:00

From Effective Java Item 18 where it suggests we can combine interfaces and abstract

  • 0

From Effective Java Item 18 where it suggests we can combine interfaces and abstract classes by providing an abstract skeletal implementation class. I am wondering when should we use skeletal implementation for simulated multiple inheritance ? and what are the advantages and disadvantages ? Can someone give an example ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:16:43+00:00Added an answer on June 14, 2026 at 4:16 pm

    The point of a “Skeletal class” as you put it is mainly to enforce certain ground rules that will govern the use of your design. By themselves, interfaces and abstract classes cannot do the job. Consider the interface for example

    1. You cannot specify any implementation details about your methods
    2. variables specified at interface level must be static.
    3. Interfaces cannot implement anything (class or interface)

    So this means that using an interface alone to specify the rules of a design will still permit abuse of the operations defined in your interface, you’ll not be able to specify important class level variables or take full advantage of inheritance.

    Now take the abstract class

    1. Java does not support multiple inheritance, so deriving the benefits of multiple classes, abstract or otherwise is not possible
    2. You cannot derive the full benefit of polymorphism from an abstract class based design only as interfaces (to me) are at the top of the polymorphism tree

    Combining both gives you the best of both worlds in that

    1. An abstract class can implement an interface. An implementing class can extend your abstract class to derive the benefits of already implemented methods of the interface. And this chaining can go on for as many abstract classes as necessary, up till a concrete implementation
    2. An implementing class can implement as many interfaces as necessary for marker-type purposes. So you can have as many Serializable type interfaces for marking that will be extended by other interfaces
    3. A class implementing an abstract class (that implements an interface) can be defined as a type of the interface to benefit from better polymorphism while being instantiated as a child of the abstract class

    Consider this use case

    • You have an interface that has about say, 6 methods that will govern the use of a class
      then you have a marker interface that you need simply for identification purposes, so you can use maybe instanceOf operator on.
    • Now in that first interface, you need to enforce a specific implementation of just 3 of those methods, the remaining 3, you’re going to leave to the end users of the class.
    • So interface A has 6 method definitions, Interface B is just a marker for a class to say “I’m a type B class”. Now you’ll have class A, an abstract class, implement both interfaces A and B
    • In your abstract class, you implement just the desired 3 methods, Then you leave the implementation details of the other 3 methods to the final consumers of that abstract class
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From Effective Java Second Edition, Item 28 : Do not use wildcard types as
From Effective Java 2nd edition item 67 page 266-268: The background thread calls s.removeObserver
From Effective Java ( Item 1 : Consider static factory methods instead of constructors
From Effective Java 2ed Item 2: telescoping constructor pattern, in which you provide a
This is a follow-up from this question : Effective Java 2nd Edition, Item 17:
Consider the following from Effective Java Item 11 (Override clone judiciously) where Josh Bloch
from p.46 Effective Java Joshua Bloch. Item 9: ALways override hashCode when you override
Following is from Effective Java: The association between a nonstatic member class instance and
From this context: import itertools lines = itertools.cycle(open('filename')) I'm wondering how I can implement
Quoted from Effective Java - Second Edition by Joshua Bloch For floating-point fields, use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.