It can be used in three places
primitive: The value of primitive variable cannot be changed once initialized.
- compile time constant:
- value initialized at run time:
static final int MAX_CAR = 20;
reference : This reference cannot point to another object once initialized.
final int max_car = rand.nextInt(20);
final String myStr = "Hello World";
This method cannot be overridden, thus retain method's behavior during inheritance.
This class cannot be inherited, maybe for security or safety reasons.