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?
In theory, yes, if you use a mutable type for your “constant”, e.g.
AtomicReference.However, it would be an awful design!
Output:
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.