The Difference between an Application and an Applet

Team-Fly

The difference between a Java application and a Java applet is how they are executed. An application is executed by a Java interpreter that loads the application's main class file, whereas an applet is executed through a Java interpreter that works with a browser and must be included on a Web page to run. Because Java applets are executed on the Web user's computer, certain restrictions limit what they can do. If these restrictions were not in place, it would be easy to write Java programs capable of planting viruses or violating the security of the Web user's computer (for example, by looking for Intuit's Quicken program and then sending all of your credit card numbers to an Internet site.)

In general, most Web browsers place the following restrictions on applets:

  • They cannot read or write files to a user's file system.

  • They cannot make network connections other than to the host where they originated.

  • They cannot start any program on the computer on which they are running.

  • They cannot load program or library files that are stored on the computer on which they are running.

A Java application must have a main() method, which is where the application starts to execute. An applet uses other methods, such as init(), start(), stop(), and destroy(). However, it is possible to write a class that can be used as both an application and an applet, because applets ignore the main() method when they are executed.


Team-Fly


Java & BAPI Technology for SAP
Java & BAPI Technology for SAP
ISBN: 761523057
EAN: N/A
Year: 1998
Pages: 199

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net