This paper briefly introduces the method of distinguishing between applet and application

Java language is a semi compiled and semi interpreted language. Java user programs are divided into two categories: Java application and Java applet. There are some differences in the composition structure and implementation mechanism between the two types of procedures:

Application 1. Application is mainly the development of desktop applications. Application cannot be loaded with JSP. 2. Java application is a complete program that can run independently. 3. After the Java application program is compiled, it can be interpreted and executed with an ordinary Java interpreter. 4. Each Java application program must contain one and only one main method. When executing the program, first look for the main method and start running with this as the entry point. The class containing the main method is often called the main class, that is, Java application programs contain a main class.

Applet 1. Applets are generally used for plug-in development on B / s pages. 2. The Java applet program cannot run alone. It must be embedded in the web page written in HTML language and controlled by a Java compatible browser. 3. Java applets can only be executed through a web browser or applet viewer. 4. The applet program does not have a main class containing the main method, which is why the applet program cannot run independently.

Now let's compare the differences between the two, so as to better distinguish them.

(1) Different operation modes. Java application is a complete program and can run independently; Java applet program cannot run alone. It must be embedded in a web page written in HTML language and controlled by a Java compatible browser. (2) The running tools are different. After the Java application program is compiled, it can be interpreted and executed with an ordinary Java interpreter, and the Java applet must be executed through a web browser or applet viewer. (3) The program structure is different. Each Java application program must contain one and only one main method. When the program executes, first look for the main method and start running with it as the entry point. The class containing the main method is often called the main class, that is, the Java application program contains a main class. The applet program does not have a main class containing the main method, This is why applet programs cannot run independently. Although the applet does not have a main class containing the main method, the applet must have a slave Java applet. Applet derived class, which is provided by the Java system. (4) The restrictions are different. Java application programs can be designed to perform various operations, including the operation of reading / writing files, but Java applets can neither read nor write the disk files of the site. However, due to the introduction of applets, web pages have dynamic multimedia effects and interactive performance, which is called hypertext The web page written in plain text HTML language really has the function of hypertext. It can not only display text information, but also have various picture effects and dynamic graphic effects, so as to make the page look vivid and beautiful; In addition, applet adds functions such as buttons to the web page, thus increasing the interactivity.

The above is the method to distinguish between applet and application introduced by Xiaobian. I hope it will be helpful to you.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>