by Dinesh Thakur Category: AWT and Applets

Java programs consist of applications and applets. Java applications are stand-alone programs and typically executed using the Java interpreter. On the other hand, Java applets are executed in a web browser or in a special window known as the Appletviewer; however, the compilation stages of both are the same.

The structure of applets differs from that of application programs; for example applets do not have the main () method. Applets do not interact with the console operations (that is, I/O operations) like application programs do. Applets allow the user to interact through the AWT .

Applets differ from applications in the way they are executed. An application is started when its main () method is called. In the case of applets, an HTML file has to be created, which tells the browser what to load and how to run the applet. Java, however, allows a programmer to create software code that can function both as a Java application and as a Java applet using a single class file. Table illustrates the similarities and differences between Java applications and applets.


                   Table Similarities and differences between applications and applets.


Java applications

Java applets

These run on stand-alone systems.

These run in web pages

These run from the command line of a computer.

These are executed using a web browser.

Parameters to the application are given at the command prompt (for example, args [0], args [1] and so on )

Parameters to the applet are given in the HTML file.

In an application, the program starts at the main () method. The main () method runs throughout the application.    

In an applet, there is no main () method that is executed continuously throughout the life of an applet.

These have security restrictions.

These have security restrictions.

They support GUI features.

They support GUI features too. Java-compatible browsers provide capabilities for graphics, imaging, event handling and networking.   

These are compiled using the javac command.

These are compiled using the javac command also.

These are run by specifying the command prompt as follows: javaclassFileName  

These are run by specifying the URL in a web browser, which opens the HTML file, or run using the appletviewer by specifying at the command prompt: appletviewer htmlFileName

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles