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

  • Home
  • SEARCH
  • 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 6528055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:29:57+00:00 2026-05-25T09:29:57+00:00

I know that based on the Java tutorials : An interface can contain constant

  • 0

I know that based on the Java tutorials:

An interface can contain constant declarations in addition to method declarations. All constant values defined in an interface are implicitly public, static, and final. Once again, these modifiers can be omitted.

Is it possible to make the values inside an interface to be shared and modifiable by all the classes that implement the said interface?

  • 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-25T09:29:57+00:00Added an answer on May 25, 2026 at 9:29 am

    In theory, yes, if you use a mutable type for your “constant”, e.g. AtomicReference.
    However, it would be an awful design!

    public interface MyInterface{
        AtomicReference<String> NAME = new AtomicReference<String>("Fred");
    }
    
    
    public static void main(final String[] args){
        System.out.println(MyInterface.NAME);
        MyInterface.NAME.set("Jim");
        System.out.println(MyInterface.NAME);
    }
    

    Output:

    Fred
    Jim

    You could use Collections, Maps, Arrays or any other type that mutably holds values for this pattern, however I would seriously request you to rethink it.

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

Sidebar

Related Questions

For instance, I know that basically all languages that are object oriented based are
Does anyone know of a diff viewer or comparison program that can do paragraph-based
I know that calling a virtual method from a base class constructor can be
I know that Java's HotSpot JIT will sometimes skip JIT compiling a method if
I know that primary keys based on Guids do not have the best performance
Since the Google App Engine Datastore is based on Bigtable and we know that's
Does anyone know of a bug tracking piece of software that has community based
Does anyone know of a JS-based terminal client? Either something that initiates an SSH
I'd like to know how you address the seemingly low productivity of Java EE-based
I have a java-based server that allows client applications to connect via other programming

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.