Original http://lavasoft.blog.51cto.com/62575/18771/
Feel the original is too messy. Refine it, please. Please correct me.
Static
1. Modify methods and variables (to be static variables, static methods), or to form static blocks of code (cannot appear in the method, other places can be seen)
2. Modifying variables, sharing the same variable
3. Modification method, cannot invoke non-static member, cannot contain abstract object (because static member class is effective when loading, abstract object does not take effect contradiction)
4. Static code block, cannot call non-static members, cannot contain abstract objects, can be any position (except no longer inside the method)
5. Call directly through the class name. Method name/variable name
Final
1. Modifying classes, variables, methods
2. The modifier class indicates that it cannot be inherited, and there are no subclasses
3. Modifier variables represent constants
4. The modification method means that the inheritance cannot be overridden and the construction method cannot be modified.
5.fianl method parameter void F1 (final int i) {} means that within a method I is a constant
Static final
1. Modifier variables represent global constants
2. The modification method represents a static method that cannot be overwritten, and cannot have non-static members and objects that are not instantiated
This article from "Qiang Qiang" blog, declined reprint!
Java keyword final, static usage summary