Java Learning 1.1 - Java Why cross-platform?

    First, tell us about all levels of Java, first put a picture:

    Hardware, operating system and operating system interfaces: three levels do not say we all know, there are many operating systems, such as Windows, Linux. Windows is divided into win7, win10, win xp etc; Linux have Ubuntu, CentOS; operating system interface is reserved for system developers to facilitate the call to control the operating system's hardware without requiring the programmer to know how to achieve and only you need to know the parameters. But certainly different systems have different interfaces, even among the same family of operating systems, interfaces are different, like on between win7 and win10, there are certainly differences in the operating system interface. With this in mind, we continue to look down:

 

    We know that different interfaces between the various systems, if you want to perform the same function on different operating systems, it is bound to do some changes in the job, even a great difference between the two operating systems, to perform the same function in different platforms on behalf of I set out to do the program . But why the java program can not care about such a difference, you can make a program for all operating system? This is the role of the JVM.

    

    JVM Java Virtual Machine that is, its main role is the equivalent of a translator, JVM down to associate all operating systems, he can operate all operating systems, providing a unified interface up, that is JavaAPI, as long as the programmer-oriented programming JVM, will want to make the operating system do tell JVM, it will convey to talk to the operating system, as in the end how to convey, and no need to consider this. As a result, as long as the JVM-oriented programming, you can do a program can run on all platforms. Java language and platform independent, this is the reason Java platform can cross.


    顺便提一嘴:跨平台会造成什么呢?Java通过JVM翻译,C/C++没有这样的过程,所以可以肯定的一点是Java运行速度不如C/C++的速度。但是随着JVM虚拟机的技术和系统硬件的发展,以后说不定Java的速度就能赶超C/C++了。

Guess you like

Origin www.cnblogs.com/hao-frido/p/12057742.html