Java learning notes - Java architecture introduction

zhaozj2021-02-16  81

Java architecture introduction

Why use Java

Because Java is designed for the network, it guarantees secure, robust and platform-independent programs to spread through network, running on many different computers and devices.

2. The challenges and opportunities brought by the network

One of the challenges faced by software developers is this gradually growing hardware environment with network, which is increasingly wide, and the platform-independent program written in Java will be more prone to write, manage, and maintain, the price is also Lower.

Another challenge brought by the network for software developers is security. Java provides a protected environment that can be run from different custom security levels from the network. Moreover, the Java architecture has a certain guarantee for the robustness of the program.

The omnipotent network brought a chance to release online programs. Java uses this advantage to transmit small binary code on the network. So the end user is always the latest version.

The movable code brings another opportunity: a moving object - it passes the code and status on the network.

The platform innocence, security, and network mobility, the three aspects of the Java system jointly complement Java and development network computing environment.

3. Architecture

Java programming language

Java Class file format

Java Application Programming Interface (API)

Java virtual machine

Java virtual machines and Java API combines Java platforms that can be run in any place.

4. 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, which can load the Class file from the program and the API. The byte code is executed by the execution engine.

Different Java virtual machines, their execution engine implementation may be very different.

The simplest execution engine is a one-time interpretation bytecode.

Another implementation engine is faster, but it also consumes memory, called "Just-in-Time Compiler). The first time the byte code will be compiled into the machine code. The compiled local machine code is cached and can be reused when the method is called.

The third execution engine is an adaptive optimizer. Virtual Machine Monitor the activity of running program and record the most frequent code segment.

The last virtual machine consists of a hardware chip, which performs Java bytecode with a local method, which is actually in the chip in the chip.

Java offers people a chance to choose. If you want to use resources on a particular host, they cannot access from Java API, then write a platform-related Java program to call local methods. If you want to ensure that the platform's platform is independent, you can only access the underlying system resources through the Java API.

5. Architecture of class loading

A Java application can use two types of loaders: Bootstrap class loaders and user-defined class-loaders. User-defined class load makes it possible to extend Java applications at runtime. Since the type loader is written using Java, use any style that can be expressed in the Java code to perform class loading. These classes can be downloaded from the web, which can be read from some databases and can even be generated.

When the loaded class references another class, the virtual machine will load the referenced class using the class loader loaded with the first class. So only one class loaded by the same class loader is only available in the loaded class default. In this way, Java's architecture allows you to create multiple namespaces in a Java application. Every class loader in the Java program in runtime has its own namespace. Categories loaded by different class loaders in different namespaces, they cannot access each other unless the application is explicitly allowed to do so.

By allowing instantiated user-defined type-up types to download Class files from the web, the architecture of the Java class-loaded architecture provides support for network mobility; Class of different sources by allowing the use of different user-defined classes to load different sources The architecture of the Java class-loaded architecture provides support for security. It places different source Class files in different namespaces, which can limit or block mutual access between different source code. 6. Java Class file

Java Class files are mainly adaptable to the network in terms of platform-independent and network mobility.

It is an unrelated task in the platform to provide the Java program to provide a binary form of the underlying host platform.

The Java Class file also serves as a crucial role in the Java architecture that supports network mobility. First, the Class file is designed compact, so they can quickly transmit it online. Second, since the Java program is dynamically connected and dynamically extended, the class file can be downloaded when needed.

7. Java API

Java API is unrelated and security by supporting platforms, making Java adapt to network applications. Java API is a collection of runtime, which provides a standard method for accessing host system resources. When running a Java program, all loaded Class files (including from the application and extracted from the Java API) and all loaded dynamic libraries (containing local methods) form the entire program running on the Java virtual machine.

8. Java programming language

Use the Java language to write programs to make full use of many software technology:

Object-oriented

Multithreading

Structured error handling

Garbage collection

Dynamically connected

Dynamic expansion

One of the most striking reasons using Java language is that it can improve the efficiency of developers; and its most important disadvantage is that the execution speed is slow.

转载请注明原文地址:https://www.9cbs.com/read-15283.html

New Post(0)