• Register

Definition of Static
Static could be a keyword, applicable to the categories, variables, methods, and blocks. the category members, class, and blocks will be created static mistreatment “static” keyword ahead of the name of the category members, class, and blocks severally. once a category member is asserted as static, it becomes world for all alternative members of the category.
•    A static variable acts sort of a world variable for all alternative knowledge members of the category.
•    A static variable will be accessed before any object of the category exists.
•    A static variable will be accessed with the category name within which it's outlined followed by the dot(.) operator.


Static strategies
•    A static technique will solely decision alternative static strategies solely.
•    A static technique will access static knowledge solely.
•    A static technique can't be remarked “this” or “super” in any conditions.
•    A static technique will be accessed with the category name within which it's outlined followed by the dot(.) operator.


Static category
•    Java will have the idea of nested static category. The outer category can't be created static whereas the innermost category will be created static.
•    A static nested category can't access the non-static member of the outer category.
•    It will solely access the static members of the outer category.


Static Block
Static block is dead just once once the category is loaded. accustomed initialize the static variables of the category.


Final Keyword
Final could be a keyword applicable to the category, variable and strategies. The class, variable and therefore the technique is asserted as final mistreatment the keyword “final” preceded by their name. Once a variable is asserted as final; it can't be changed additional within the program. A final variable should be initialized at the time declaration. Final variables don't occupy memory on per-instance basis. All the objects of the categories share constant copy of the ultimate variable.


The technique declared as final can't be overridden by the taxonomic group of that category within which final method is asserted. once {a category|a category} is asserted as final alternative category can't inherit that final class. C++, C# don't support the idea if final keyword. Java supports the idea of ultimate keyword and in Java; category, variable, and technique will be declared as final.

 

3,280 points
7 4 2