EMZETT.
Login

final

In short: final prevents changes: variables stay constant, methods cannot be overridden, classes cannot be inherited.

In more detail: The keyword has three meanings depending on where it is used.

In Depth

  • Variable: assign once, unchangeable afterwards (final int MAX = 10;).
  • Method: may not be overridden with override.
  • Class: cannot be extended (for example String).

Constants are usually written static final in CAPITAL LETTERS. See static, constants.

See also: static, Constants (final), Override