Use of private static final declarations

When we declare a variable like this:

private static final String foo = "FOO!";
  • private
    • Variable can only be used in the current class, not in any parent or child classes
  • static
    • There will only be 1 instance throughout the entire class
  • final
    • “FOO!” will remain the value of this variable at all times, it cannot be changed.

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.