the final keyword123, the final member variable represents a constant, can only be assigned once, and the value will no longer change after the value is assigned. (for const inC + +) 4, final cannot be used to decorate a construction method. "Why
Depending on the context, there are subtle differences in the Java keyword final, but it usually means "this cannot be changed." "There are two reasons why you don't want to change: one is efficiency, the other is design. Because there are two
Depending on the context, Java's keywordfinal also has subtle differences, but usually refers to "this cannot be changed." "There are two reasons not to change: one is efficiency, and the other is design. Because two reasons are very far apart, the
Depending on the context, Java's keywordfinal also has subtle differences, but usually refers to "this cannot be changed." "There are two reasons not to change: one is efficiency, and the other is design. Because two reasons are very far apart, the
Http://www.importnew.com/7553.htmlFinal Integet len = 10;len = 100;This compiles, however, because final-pointing objects are modified, but the final variable cannot point to the new object, where the assignment action is to point to the new
A brief analysis of new,this,super,final keywords in Java
New Keyword
For example people person=new people ();
create an object what does it do in memory? load the People.class file at the specified location on the hard disk into memory first.
Final classthe final class cannot be inherited, and once the class is modified with final, it means that all the methods in the final class are implicitly specified as the final method
Final methodin the process of inheriting a class, subclasses
I. Heavy Load
Overloading ):
(1) method Overloading is a means for classes to process different types of data in a unified manner. Multiple Functions with the same name exist at the same time and have different parameter numbers/types. Overload
Final, as the name implies, is "final, final."
The final modification method can get the "last method", that is, a method that cannot be overridden by a quilt.
Class nbaplayer{ final public function eat ($food) { echo ' food is '.
What are the final keywords modified?Final makes the modified variable "unchanged", but because the object type variable is essentially a "reference", it also has two meanings: the reference itself remains unchanged, and the referenced object.The
Final (Ultimate)
(1) Final can modify variables, methods, classes.
(2) A class that is final decorated cannot be inherited by another class
(3) The final modified method cannot be rewritten.
(4) The final modified variable can only be assigned
The final effect varies with the type being decorated
1. Attributes or variables in the final modifier class
Regardless of whether the attribute is a basic type or a reference type, the final effect is that the value stored in the variable cannot be
In Java, final keywords may be used to modify data, methods, and classes.
I. Final data modification
Final-modified data is used to tell the compiler that a piece of data remains unchanged. Sometimes it is useful to change the data. For example:
1
Final meaning: Ultimate, immutable.1, the modifier variable, is constant, the value is immutable;2, the modified object, the value is variable, the reference does not change;3, modification methods, methods can not be rewritten;4, decorated class,
Static
1. In a class, a property decorated with static is called a static property. is common to all objects of this class, is stored in a static store, and all objects of that class can be accessed and accessed by the same variable. Can be used as
Final classwhen a class is defined as final class, it means that the class cannot be inherited by other classes, that is, it cannot be used after extends. Otherwise, errors are obtained during compilation.
Package Com.iderzheng.finalkeyword;
Final (final) modified variables, if they are members of the class, the naming requirements are all larger, if it is more than one word, use the underline to separate.If it is a local constant, you can start with lowercase.
If you do not want
Final represents final state, invariant, and can be used to modify classes, methods, variables.
1. When modifying a class, the class is Sung, and the class cannot be inherited, but the non final instance variable of the class can be modified;
2,
Key concepts: Abstract classes, abstract methods, static classes, static internal classes, static methods, static variables, constants, global constants.
I. The use of abstract, modifier, you can modify class and Method 1, abstract modifier class,
In a programming language, there is a way to tell the compiler that a piece of data is immutable. There are two requirements
1. A compiler constant that never changes
2. A value that is initialized at run time, and this value is not changed
In
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.