Java Memory Model-final, java model-final
Compared with the locks and volatile described earlier, the read and write operations on the final domain are more like common variable access. For final domains, the compiler and processor must follow two
This example describes the final keyword usage in java. Share to everyone for your reference, specific as follows:
Depending on the context, the Java keyword Final also has a subtle distinction, but it usually means "this is immutable." "There are
I. Construction method: When a class is instantiated, the first thing to do when it is new is the constructor, in the Java class, if the declaration constructor is not displayed, the JVM gives the class a default constructor. A class can have more
Compared to the lock and volatile described earlier, the read and write to the final domain is more like normal variable access. For the final domain, the compiler and processor are subject to two reordering rules:
Writing to a final field
1. Memory Allocation in Java
JavaProgramDuring runtime, the memory structure can be divided into method, stack, heap, and local method stack (called by JNI in Java.
JVM allocates a stack (method stack) for each running thread. The stack stores
This article belongs to author original, the original text is published in Infoq:http://www.infoq.com/cn/articles/java-memory-model-6Compared to the lock and volatile described earlier, the read and write to the final domain is more like normal
When it comes to the final keyword, it's probably a lot of people who are not unfamiliar with the final keyword when using anonymous internal classes. In addition, the string class in Java is a final class, so today we'll look at the use of the
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'
This article transferred from: http://www.infoq.com/cn/articles/java-memory-model-6Compared to the lock and volatile described earlier, the read and write to the final domain is more like normal variable access. For the final domain, the compiler
Compared to the lock and volatile described earlier, the read and write to the final domain is more like normal variable access. For the final domain, the compiler and processor are subject to two reordering rules:
Writing to a final field
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.