Using a final class for string constants I want to use something like Setting.RES_WIDTH in my code without the need for a getter function (i.e.: custom getter, enum's .name(), .toString() or .valueOf()).

Someone suggested using a final class, so I wrote this:

public final class Setting {

    public final static String RES_WIDTH        = "resolution_width";
    public final static String RES_HEIGHT       = "resolution_height";
    public final static String FULLSCREEN       = "fullscreen_enabled";
    public final static String VSYNC            = "vsync_enabled";

    //Prevent someone from creating an instance of this class
    private Setting() {}
}


This code works, but I am wondering if there are any kind of issues (performance, GC, etc) that might arise from using this.
There won't be any GC overhead since there won't be any instantiated instances to collect.

I think there's a small overhead by accessing a class' static field rather than an in-scope variable ; however, I would consider it largely worth the improved readability/maintainability.

I guess you could also argue you'll use up a little bit more of your permGen / Meta space, but I've never heard it be a consequent problem.