Four core concepts in Java

Source: Internet
Author: User

Java has become a large and complex technology platform, for developers, to better grasp the Java technology, in-depth understanding of the underlying technical processing details is essential. Now let's introduce the four core concepts of Java:

1.Java Virtual Machine

The main task of the Java Virtual machine is to load the class file and execute the bytecode. The Java virtual machine contains a class loader that can load class files from programs and APIs. Only those classes that are required for program execution are loaded in the Java API. The byte code is executed by the execution engine. In different Java virtual machines, the execution engine can be very different. In a software-implemented virtual machine, the simplest execution engine is a one-time interpretation of bytecode.

Another execution engine is faster, but also consumes more memory, called the Just-in-time compiler (Just-in-time compiler). In this case, the first byte code executed is compiled with the cost of machine code. The compiled local machine code is cached and can be reused when the method is invoked later.

The third type of execution engine is the adaptive optimizer. In this approach, the virtual machine interprets the bytecode at the beginning, but monitors the activity of the running program and records the most frequently used code snippets. When the program is running, the virtual machine compiles the most frequently used code into the cost code, and the rest of the code continues to be byte-coded because it is not very frequent and continues to be interpreted by the virtual machine.

An adaptive optimizer enables Java virtual machines to perform optimized local code in 80%~90% time, and only needs to compile 10%~20% code that affects performance.

2. Class Loader architecture

A Java application can use two kinds of loaders: "Start (bootstrap)" Class loaders and user-defined class loaders. Starting the class loader (which is the only one in the system) is part of the Java Virtual Machine implementation. Startup class loaders typically use a default way to load classes from local disks, including Java API classes (the Startup class loader is also called the original class loader, the System class loader, or the default class loader).

Java applications can install user-defined class loaders at run time, and such loaders can load classes using custom methods. For example, download the class file from the network. Although the Boot class loader is an essential part of virtual machine implementations, user-defined class loaders are not, but user-defined class loaders can be written in Java, can be compiled into class files, can be loaded by virtual machines, and can be instantiated like other objects.

3.Java class file

Java class files make Java more suitable for the network primarily in terms of platform independence and network mobility. Its role in platform independence is to provide Java programs with binary forms of services independent of the underlying host platform. This approach breaks the tradition of languages such as C or C + +, where programs written in these traditional languages are usually compiled first and then connected to separate binaries that specifically support specific hardware platforms and operating systems.

Typically, binary executables on one platform cannot work on other platforms. The Java class file can run in any binary file on the hardware platform and operating system that supports Java virtual machines.

4.Java API

Java APIs enable Java to adapt to network applications by supporting platform independence and security. The Java API is a collection of runtime libraries that provides a set of standard methods for accessing host system resources. Java API class file used by the virtual machine Loader's class file when running Java programs. All loaded class files, including those extracted from the application and from the Java API, and all of the loaded dynamic libraries (which contain local methods) compose the entire program running on the Java Virtual machine.

Hope that through the introduction of this article, can bring you help.

Related Article

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.