Clairvoyant
The final keyword, which can decorate data, methods, classes.
Some students may be silly to find out, here can quickly understand the final;
Final instance domain:
You can define an instance field as final, and you must initialize the domain when you build the object, that is, you must ensure that the value of the field is set after each constructor is executed, and in subsequent operations, it cannot be modified, for example, You can declare the name field in the Employee class as final, because after the object is built, the value is not modified. That is, there is no SetName method.
Class Employee
{
Private final String name;
}
The final modifier mostly applies a basic Type field, or immutable class, String decoration.
The use of final modification of mutable classes can cause confusion.
Private final Date hiredate; This simply means that the object reference cannot be changed after the object constructor, and does not mean that the HireDate object is a constant, and any method can invoke the object referenced by the HireDate.
Do you understand the mystery?
Do not understand the recommendation of a final introduction in more detail: http://www.cnblogs.com/dolphin0520/p/3736238.html
Java Final keyword clairvoyant