Is it possible to change the value of variables in an interface class using XmlDecoder and XmlEncoder?.
I have an interface class that contains variables that needs to be implemented by other classes. however the value of these variables needs to be changed after some time.
I have an interface class the contains variables that needs to be implemented by other classes.
Interfaces can't contain variables as such - they can only contain constants, so it makes no sense to try to change the value of them.
From JLS 9.3:
Every field declaration in the body of an interface is implicitly public, static, and final.
Your interface should contain appropriate getters/setters instead - or have an abstract superclass which contains the appropriate fields.
See more on this question at Stackoverflow