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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:20:26+00:00 2026-05-24T22:20:26+00:00

I see a code where there are two interfaces having some methods with two

  • 0

I see a code where there are two interfaces having some methods with two methods having same name. Then there is a class that implements these interfaces i think it should not have compiled because of ambiguity in method names. Why does it works fine.

  • 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-24T22:20:27+00:00Added an answer on May 24, 2026 at 10:20 pm

    Every language in which this problem can occur will solve the problem differently. In some languages, this can be an error; C++ is this way. But in Java, as long as the two methods have compatible exception specifications — i.e., as long as it’s actually possible to implement a method that satisfies both interfaces — then it’s specifically allowed by the language spec. The one method satisfies each interface, and everything is fine. It’s meaningless to ask which interface the method belongs to; it belongs to both, or to none.

    Note that you can have a class with a method x(), and then extend that class with a child class that declares itself to implement some interface that includes a method x(); the child automatically satisfies the interface using the inherited method, which itself was declared with no knowledge whatsoever of the interface. As you can see, Java interfaces are purely declarative; they don’t care where the method comes from, only that the class in question includes them.

    I can’t speak for PHP, but perhaps it’s just the same, but I’m sure it differs in some of the small details.

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

Sidebar

Related Questions

In some existing code there is a test to see if the user is
There are two classes: class Person include Mongoid::Document field :name embeds_many :addresses end class
I'm trying to create a C# class that can call the same methods on
There is this famous quote that says Procedural code gets information then makes decisions.
There is code for save button, but I can't see any code behind the
i have written the following code: As you can see there is a for
See code below, for some reason it only works when I put a breakpoint
I'm updating some old old code (that works for now, but is using OpenTransport,
Given the following two interfaces (these are small examples, not my actual implementation): public
I have a project that runs some code on SSIS in SqlServer 2005 and

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.