Java Reference

Java Reference Home | Smart Soft Home

final
The keyword final can be used in one of two ways: as a variable modifier or as a method modifier.

Description #1 - Variable Modifier

Indicates that a member field is constant. This modifier is typically used with the static modifier.

Example #1 - Variable Modifier

public static final double pi = 3.14;

Description #2 - Method Modifier

Indicates that a method can not be overridden.

Example #2 - Method Modifier

public final void foo(){
  ...
}