Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the development and operation principle of Java program?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "what is the development and operation principle of Java program". In daily operation, I believe that many people have doubts about the development and operation principle of Java program. The editor has consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "what is the development and operation principle of Java program". Next, please follow the editor to study!

1. Write the source file

The code written is called "source code" or "source code". In general, we save the source code to a text file with the suffix .java, which is called the source file. For convenience, we will keep the file name consistent with the class name (including uppercase and lowercase).

2. Compilation

The source files are written by programmers, and we can easily recognize the meaning of each line of code, but in a computer, CPU can only recognize binary instructions. So, what you need to do now is to convert between the source file and the computer instructions. Because of the structure and characteristics of the Java language, designers first convert the source file into a special binary file, and then give the binary file to the Java runtime environment (JRE) for execution. The process of converting to a binary file is called compilation (which uses the javac command), and the resulting binary file is called a bytecode file (suffixed with .class). If Test.java is compiled, it will generate Test.class. This process is all done automatically by the Java compiler and does not require any special operation by the programmer.

3. Run

The principle of opening and running Java programs is not simply to give bytecode files (.class files) to the operating system to execute, that is because the size, scope and calculation of the data in different operating systems are very different, which will cause the same code to run differently between different systems, which is not what designers want to see.

The designers of Java have come up with a clever idea, which is to write a virtual machine (JVM) that can execute Java programs correctly for different operating systems, and then build this virtual machine into Java's runtime environment (JRE), so that the same piece of Java code can run the same effect on different operating systems. The process of handing the bytecode file (.class) to the Java runtime environment (JRE) is called the run of the Java program (which uses the java command).

At this point, the study on "what is the principle of the development and operation of Java programs" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report