Why can final object be modified?

Posted by Matt McCormick on Stack Overflow See other posts from Stack Overflow or by Matt McCormick
Published on 2010-03-12T19:17:27Z Indexed on 2010/03/12 19:27 UTC
Read the original article Hit count: 386

Filed under:
|

I came across the following code in a code base I am working on:

public final class ConfigurationService {
    private static final ConfigurationService INSTANCE = new ConfigurationService();
    private List providers;

    private ConfigurationService() {
        providers = new ArrayList();
    }

    public static void addProvider(ConfigurationProvider provider) {
        INSTANCE.providers.add(provider);
    }

    ...

INSTANCE is declared as final. Why can objects be added to INSTANCE? Shouldn't that invalidate the use of final. (It doesn't).

I'm assuming the answer has to do something with pointers and memory but would like to know for sure.

© Stack Overflow or respective owner

Related posts about java

Related posts about final