Logo F2FInterview

Applet Interview Questions

Q   |   QA

Applets implements functionality of a client. Applet is a dynamic and interactive program that runs inside a Web page displayed by a Java-capable browser. We don’t have the concept of Constructors in Applets. Applets can be invoked either through browser or through Appletviewer utility provided by JDK.

Following are methods in the life cycle of an Applet:

  • init() method - called when an applet is first loaded. This method is called only once in the entire cycle of an applet. This method usually intialize the variables to be used in the applet.
  • start( ) method - called each time an applet is started.
  • paint() method - called when the applet is minimized or refreshed. This method is used for drawing different strings, figures, and images on the applet window.
  • stop( ) method - called when the browser moves off the applet’s page.
  • destroy( ) method - called when the browser is finished with the applet.

When an applet begins, the AWT calls the following methods, in this sequence:

  • init()
  • start()
  • paint()

When an applet is terminated, the following sequence of method calls takes place :

  • stop()
  • destroy()

We can pass parameters to an applet using <param> tag in the following way:

  • <param name=”param1″ value=”value1″>
  • <param name=”param2″ value=”value2″>

Access those parameters inside the applet is done by calling getParameter() method inside the applet. Note that getParameter() method returns String value corresponding to the parameter name.

Use the parseInt() method in the Integer Class, the Float(String) constructor or parseFloat() method in the Class Float, or the

  • Double(String) constructor or parseDoulbl() method in the class Double.

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: