Visible

zhaozj2021-02-08  422

1. Java as a programming language: source code can be transplanted

As a programming language, Java provides a portable-source code mounting of the most familiarity of people. This means any of the Java program, not the CPU, operation system or Java compiler, will produce the same results. This is not a new concept. People use C, C to produce the same effect. But use C or C programming people can have too many choices, and there is no strict definition in many details, such as: the value of the unin-initial variable, the release of the released memory, the tail value of the floating point operation, etc. In addition to nothing, it is strictly based on the concept of the system. No, this portability can only be an idea of ​​ideas and cannot be practiced. In general, although C and C have a strict language definition, the Symantics is not standardized. This kind of uniformity of this language makes the same step in the different lines of production. There is always the same time the system is completely the same, but only the setup of the compiler is different, and it will produce unexpected results. Java is different. It defines a strict language intention, but makes the compiler do not bear the work of this. In addition, the definition of Java to the program is also strict than C and C , such as: Garbage Collection, enables the program, can't access the off-boundary memory; it provides certain values ​​for the unmelted variables. Its characteristics can reduce the difference between Java's Java program running on the non-flat platform, which also makes Java have a better platform that is better than C and C more than C and C in the case where the Java virtual machine is not available. However, these features also have its unsuccessful side. Java wants to operate on a computer with 32-bit byte length and 8-bit per word, which enables the 8-bit word long meter and some giant machines to operate Java program. On this platform, you can only run the portable C and C programs.

2. Java as a virtual machine: CPU-grantable

Multiple compilers produce a target code that can only run on a CPU (such as Intel's X86 Series), that is, making the compiler that can support multiple CPUs can also generate a target code for multiple CPUs. If you need to run the same order on three CPUs, such as X86, SPARC and MIPS, you must compile three times.

But the Java compiler is different. The Java Compiler Biometric Biochemistry is a needle to a CPU-Java virtual machine (Java Virtual Machine), not an active CPU. The Java virtual machine can cover different differences between the CPU, so that J-CODE can run on any Java virtual machine. The concept of virtual machine is not specially available in Java: Canadian University ranked a few years ago, a concept of PASCAL virtual machines; a PERL script that is widely used in UNIX servers is also an intermediate code for genetic and machinery. It is used to execute. However, the need for Java virtual machines designed to Internet applications is that it can produce a target code that is unsatisfactory. It is because of the special requirements of the Internet's full characteristics, the JVM can be quickly accepted. When the main stream of the main stream is like OS / 2, MacOS, Windows95 / NT has been brought to J-CODE.

As a virtual CPU, the Java virtual machine is independent of the source code. They can not only use Java language to be generated into J-Code, or it can be generated with ADA95. In fact, there has been a J-Code compiler that has a needle source code, including Basic, LISP and FORTH. After the source code is converted into J-Code, the Java virtual machine can be implemented without distinguishing which source code is generated. The result of this is CPU-portable.

Performing source programming as J-Code is in a variety of machines, and the disadvantage is that it is not as fast as this code is running.

3. Java is a virtual operation system (OS) and a map user interface (GUI): operates to be portable

That is, it has been translated, and most of the Windows program written by Multi-C and C cannot be run on the UNIX or Macintosh system. Why is this ? Because the programmer uses a lot of WindowsAPI and interrupt calls when writing a Windows program, the Windows program has a big difference in the call to the system function and the UNIX and Macintosh programs, so unless full Windows API is placed on other operating systems, otherwise The recoilated program is still unable to run.

Java has used a role in which a set of library functions (including AWT, UTIL, LANG, etc.) is solved. As JVM provided a virtual CPU, the Java library function provided a virtual GUI environment. The Java program is only called for the Java library function, and the library function is completed by the doubling of the operation system. Java also uses a "Least-CommmMMinTor) in its OS / GUI library to provide functional calls for a particular operating system, that is, this feature is only effective in a particular environment. The operating system is ignored. This is the same as that of the need for a needle to be able to have people who have the interfaces that have people familiar with themselves, and they can operate in other systems. The shortcomings are a strong dependence of some of the functional calls in the system, and it is difficult to implement in the virtual OS / API of Java. In this case, the programmer can only write unmissive procedures. In summary, Java features a portable surface to make it a wide range of applications in the Internet. At the same time, it has a place where it is in the need to have a high-reliability.

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

New Post(0)