JAVA final keyword, constant definition, final keyword
Final (final) is a modifier1. final can be used to modify classes, functions, and variables (member variables, local variables)2. Classes modified by final cannot be inherited by other classes.3
Please read the following procedure:
public class hello{
public static void Main (string[] args) {//(1)
System.out.println ("hello,world!"); (2)
}
}
Read this program, for most of the learning Java from, are not unfamiliar. Even if you
Java string optimization
The final keyword in Java can be used in class members (not called domains), in class methods, and in classes.
The final is used in the domain to represent:
1, a constant amount of compilation that never changes.
2, a
In Java programming, we may sometimes hope that some data cannot be changed, and that this is where the final comes into play. Final is Java'soff The key word that it represents is that this part cannot be modified. There are two reasons why you don'
Java study notes 18 --- final keywords modify variables, methods, and classes, study notes 18 --- final
The word final in English is known as "final". In fact, it also means"Unchangeable". In Java,The final keyword is "unchangeable" to better
Final:Final allows you to control whether your members, methods, or a class can be overwritten or inherited. These features make final an indispensable role in Java, it is also one of the keywords that must be known and mastered when learning Java.
Document directory
Final
From jdk1.0 to today, Java technology has undergone tremendous technological changes after more than a decade of development. however, the definition of final variables has not changed since its birth, that is, it has
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;
You always think you will, in fact, you just smattering.
Final keyword OverviewThe final keyword can be used to declare properties, methods, parameters, and classes, respectively, to indicate that the property is not mutable, that methods are
Difference and usage of final, finally, and finalize in Java, finalfinalize
1. Simple differences:Final is used to declare attributes. Methods and classes indicate that attributes cannot be exchanged, methods cannot be overwritten, and classes
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.