Talk about your understanding of the Java platform?

Source: Internet
Author: User

Question: Talk about your understanding of the Java platform? Java is the interpretation of execution, is that right? Typical answer: Java itself is an object-oriented language, with a good cross-platform ability to do "write once, run anywhere."     In addition, the GC mechanism, Java through the garbage collector to reclaim the allocation of memory, programmers do not have to worry about the inner-inch recycling problem. We have access to the JRE and JDK on a daily basis. The JRE is the Java Runtime environment, including the JVM and Java class libraries.     The JDK provides more tools, such as compilers, and diagnostic tools, on the basis of the JRE. Java is the interpretation of execution, this sentence is not very accurate. When Java code is executed, it is compiled into bytecode bytecode by Javac, and at runtime, it is converted to the final machine code through the JVM inline interpreter. But common JVMs, such as the hotspot JVM provided by Oracle JDK, provide a JIT (just in time) dynamic compiler that compiles hot-spot code into machine code at runtime, which is part of the compilation execution.     There are other aspects of this problem that can be extended, such as: Java language features, including generics, lambda expressions, and so on.     Base Class library, including collection, Io/nio, network, concurrency, security, etc.     For the daily use of more libraries, you can tidy up a bit. The knowledge and concepts of the JVM, such as the Java class loading mechanism, the common version of the JDK embedded class-loader, such as Bootstap,application,extension Class-loader, custom Class-loader, and so on. There are GC mechanisms, common garbage collector such as serial Gc,paraller gc,cms,g1 and so on. As shown in the following:

Questions about interpreting execution and compiling execution can be discussed in more detail. Usually we are not Java divided into compile time and runtime. Java compilation is different from C + +, and Java compilation generates a. class bytecode file instead of a machine code that can be executed directly.     Java is implemented through bytecode and JVM for one compilation, and everywhere. At runtime, Java loads bytecode, interprets, or compiles execution through the ClassLoader class-loader. The mainstream JDK version, such as Jjdk 8, is actually a mixed mode (xmixed). The Oracle Hotspot JVM has a built-in two JIT compiler that C1 to respond to startup speed-sensitive client mode, C2 for long-running sever mode.     By default, layered compilation (tieredcompilation) is used. When a virtual machine starts, you can specify different parameters for the run mode selection. If you use-xint only with interpretation execution, do not use compile execution. In this way, the performance advantages of the JIT compiler are discarded. The interpreter is read-by-article and is interpreted by article by clause. The-xcomp parameter is to turn off the interpreter, which causes the JVM to start much slower.     At the same time some JIT optimization methods, do not carry out profiling often can not be effectively optimized. JDK9 provides a compiler mode for AOT (Ahead-of-time compilation) that compiles bytecode directly into a machine code. It avoids the overhead of JIT preheating and so on.

Talk about your understanding of the Java platform?

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.