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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:30:54+00:00 2026-05-17T15:30:54+00:00

Extending an interface simply adds additional operations to be defined in any implementors and

  • 0

Extending an interface simply adds additional operations to be defined in any implementors and cannot break any existing implementations (unlike extending a class). But it can change (EDIT 3 WHICH CONSTANTS) and hence the PERCIEVED value of constants (EDIT 2 AS SEEN BY THE IMPLEMENTATION CLASSES).

For instance, the following:

interface A {
  int TEST = 6;
}

interface B extends A {
  int TEST = 7;
}

public class InterfacesTest implements B {
  public static void main(final String[] args) {
    System.out.println(TEST);
  }
}

yields 7, when perhaps the intent of interface A was that any implementation of A contain a test field valued at 6.

If A were to be declared final we could be assured all implementations of A see the same value of test.

So does anyone understand why this isn’t possible?

  • P.S.: This is NOT a duplicate of
    this question, I know they
    can’t be final, I’m interested in the thinking behind the design
    decision that led to this outcome.

  • P.P.S.: I understand constants in
    interfaces is usually a bad idea,
    that isn’t the issue here.

EDIT: Please check the revision history, the title of this question was edited in a way which did not reflect the question’s intent. Sorry to everyone who answered the question I wasn’t asking. Yes, interface fields are implicitly public static final, unfortunately that’s not what I’m interested in at all.

EDIT 2 To be absolutely clear: this question is about why can’t an interface block other interfaces from extending it (by being final or some equivalent).

  • 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-17T15:30:54+00:00Added an answer on May 17, 2026 at 3:30 pm

    Primary purpose of interface is not being a container of constants, it’s to define some APIs which to be implemented by concrete classes.

    And, from a lang spec (9.4. Abstract method declarations):

    Note that a method declared in an interface must not be declared final or a compile-time error occurs. However, a method declared in an interface may be implemented by a method that is declared final in a class that implements the interface.

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

Sidebar

Related Questions

I am extending a class defined in a library which I cannot change: public
In Java, Is there a way to prevent extending an interface. Since final cannot
I'm extending the functionality of a class with a subclass, and I'm doing some
I am extending a template class using C++ in Visual Studio 2005. It is
when extending a class, is it impossible to override a method without also matching
When extending classes, I find it very descriptive to use the base ( MyBase
I'm new to extending Drupal, though I've done similar kinds of things for other
I am extending my Object Property Value Diff but I realized if an object
Say I'm extending a TextBox called CustomTextBox in .net. In certain situations I would
I'm in the process of extending and improving a website that has quite a

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.