Answer: – Application constituter only one class of java program. The other type of the program is applet. Applets are some application that are accessed on an internal server, turn over the internet, automatically installed and run as part of web document. After an applet arrives on the client, it has limited access to resources, so that can produce an arbitrary multimedia user interface and complex computation without introducing the risk of viruses or branching data integrity.

Many of the issues connected with the creation and use of applet are found in part 2, when applets package is examined however, the fundamentals connection to the creation of an applets are presented here, because applets are not structured in the same way as the programs that have been used thus format. A general format of a simple applet is –

import java.awt.*
import java.applet.*
public class SimpleApplet extends Applet
{
                public void paint(Graphics g)
                {
                                g.drawString("A Simple Applet ",20,20);
                }
}

Applet can be used in two different types called local and remote applets one, we can write our Owen applets and embed them into web pages.  Second, we can download an applet from remote computer system and the embed into a web page or in other words an applet developed locally and stored in a local system in known as local applet. When web page is trying to find a local applet, it does not need to use the internet and therefore the local system does not require the internet connection. It simply searches the directions in the local system and locates and loads the specified applets.

The remote applet is that which is develop by someone else and stored on a remote computer connected to the internet. If our system is connected to the internet, we can download the remote onto our system via at the internet and run it. In on to locate and load a remote applet, we must know the applets address on the web. The address is known as uniform resource locator (URL) and must be supplied in the applets HTML document as the value of the CODEBASE attribute.

Both applets and standalone application of java programs, there are significant difference between them. Applets are not full featured application program they are usually written to accomplish a small task or a component of a task. Since they are usually designed for use on the internet, they impose certain limitations and restrictions in their design. They are –

  1. Applets do not use main() methods for initiating the execution of the code. Applets when loaded, automatically call certain methods of applet class to start and execute the applet code.
  2. Unlike stand-alone applications, applets cannot be run independently. They are run from the inside a web page using a special feature known as HTML tag.
  3. Applets can’t read from or write to the files the local computer.
  4. Applets can’t communicate with other servers on the network.
  5. Applets can’t run any program from the local computer.
  6. Applets are restricted from using libraries from other language such as C or C++.

All these restrictions and limitations are placed in the interest of security of system. These restrictions ensure that an applet can’t do any damage to the local system.

Advertisements