JDK Learning Path----System

Source: Internet
Author: User

1:system is a final decorated class that cannot be inherited and can be called

2:system class has a native decorated method, native decorated method means that the method is not implemented locally, but in other languages to write programs to operate the operating system, the Java language can not operate on the operating system, so it is possible to use this way to program in C language, Implement the operation of the operating system, and then compile it into a dynamic library on the line. Java is a JNI that allows Java to use functions written in other languages (JNI is Java Native Interface Java Native interface)

The following are the steps to write JNI:

A. Writing a Java class with a native declaration method

B. Compiling a Java class using the Javac command

C. Use JAVA-JNI * * * * to generate a header file with a suffix of. h

D. Implementing local methods using other languages (c, C + +)

E. Generating a dynamic-link library of files written by local methods

The system class is one such example

Many static stream objects are defined in the 3:system class: Eg InputStream in, printstream out, PrintStream err

There is also a volative-modified property in the 4:system class:

private static volatile SecurityManager security = null;

Volatile

With volatile modifiers, the thread will read the variable's most-modified value each time it uses the variable. Volatile is easily misused and used for atomic operations.

Volatile-modified variables can only guarantee that the value that each thread obtains from memory must be up-to-date, but there is still a thread concurrency problem, because after the thread obtains the value from memory, the action on that variable is done after creating a copy of the variable, that is, manipulating the variable copy. Then when the thread is about to be rolled out, the value is then written back into memory, but it is possible for other threads to manipulate the variable during the operation. Therefore, there is a thread concurrency problem. Automatically writes the value back to memory after the thread executes, as if it were a lastprivage-decorated thread in multicore. The thread initializes a copy of the object with memory and then operates on the copy as if it were a copyin-decorated thread in multicore, and this object of the thread is the private variable of the thread

JDK Learning Path----System

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.