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 1114549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:01:20+00:00 2026-05-17T03:01:20+00:00

Item 16 of Effective Java 2nd edition, favor composition over inheritance says the following

  • 0

Item 16 of Effective Java 2nd edition, favor composition over inheritance says the following

“If the superclass acquires a new method in a subsequent release and
you have the bad luck to have given the subclass a method with the same signature
and a different return type, your subclass will no longer compile.

If you’ve given the subclass a method with the same signature and return type as the
new superclass method, then you’re now overriding it”

How likely is that these cases arise in a real world situation? Could anyone here give me an example from a real business app (stripping out proprietary info if needed)?

  • 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-05-17T03:01:20+00:00Added an answer on May 17, 2026 at 3:01 am

    This isn’t about how likely that scenario is. (Besides, I’m sure you’ve heard of Murphy’s Law)

    It’s about the fact that composition is much less of a binding contract than inheritance.

    Inheritance is a very strong way to bind behavior between classes, and basically Item 16 states that you should use that strong connection only when it is clear that it is necessary. For all other uses, composition should be preferred.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From Effective Java 2nd edition item 67 page 266-268: The background thread calls s.removeObserver
This is a follow-up from this question : Effective Java 2nd Edition, Item 17:
I've been reading Josh Bloch's 'Effective Java 2nd Edition'. Item 43 states 'Return empty
Effective Java (Joshua Bloch) Item 17 says : Design and Document or inheritance or
This program is from effective java 2nd edition book, I couldn't understand how the
Effective Java (Second Edition) , Item 4, discusses using private constructors to enforce noninstantiability.
This is from the item 16 of effective C++ 2nd edition scott meyers (page
In Josh Bloch's excellent book Effective Java under Item 39 he says: [D]efensive copies
Item 3 of Josh Block's Effective Java (Enforce the Singleton Property With a Private
Joshua Bloch's Effective Java, Item 51 is not about depending on the thread scheduler

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.