Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 3
    I think you misunderstand final. If it was public yet constant, it wouldn't make sense for it to be able to declare a final within the scope of a method. It is not about performance (though that can be a nice side effect) but rather conveying the intent of the code clearly to the next programmer who has to read it - "This value is set once and only once here" and be able to guarantee that contract throughout the scope of the variable. Commented May 30, 2013 at 1:37
  • And some links for that opinion - SO Is it a good practice to declare variables “final” wherever possible?, Why My Variables Are Final, and Use final liberally Commented May 30, 2013 at 1:41