The use of static final keyword in java

<div class="iteye-blog-content-contain" style="font-size: 14px"></div>

 

final : final immutable

               Can be used to decorate classes, properties and methods in Java. '

               final is used to decorate a class, indicating that the class cannot be inherited.

               Final is used to modify variables, called constants. Indicates that the value of the variable cannot be modified and can only be initialized once.

               final is used to decorate a method, indicating that the method cannot be overridden.

static static:

            Can be used to decorate classes, properties, methods and code blocks.

            Static is used to modify attributes, called class attributes [static attributes], which represent an attribute [same memory space] shared by objects of this class.

                      Static properties are called directly using the class name as much as possible

             Static is used to modify a method, called a class method [static method], which represents a method shared by objects of this class.

                       Static methods are called directly using the class name as far as possible

                       If a static method is overridden in a subclass, whether to call the superclass or the subclass depends on the type of object declaration [size=medium][size=xx-small][/size][/size]

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326614626&siteId=291194637