Java_ Some special keywords in detail (?) Solution

Source: Internet
Author: User

1. Native.

  • Indicates that the method is a local method, which actually means that the method is implemented by C + + and is compiled into a DLL, which is called by Java.
  • The Java language itself cannot access and manipulate the underlying operating system, but other languages can be invoked through the JNI (Java Native Interface) interface to enable access to the underlying.

2. Volatile.

  • General Java memory will be divided into (method area, heap) (virtual machine stack, local method stack, program counter) and other different memory areas;
  • As we all know, there is a main memory in the system, and all the variables in Java are stored in memory and shared for all threads. Each thread has its own working memory (working memory), in which the working RAM is a copy of some of the variables in main storage, the operation of all variables by the thread is in working memory, the threads cannot be accessed directly from each other, and the transfer of variables needs to be done via main memory.
  • If a variable is identified for volatile, it is read from the main memory each time the change is used, and the same is written in master memory When the variable is written.

Java_ Some special keywords in detail (?) Solution

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.