Logo F2FInterview

Applet Interview Questions

Q   |   QA
‹‹ previous1234567

A program that a Java enabled browser can download and run is an Applet.
An applet is embedded in a web-page and runs in the browser context.
The java.applet.Applet class provides a standard interface between the applet and the browser environment.

Applets cannot perform actions such as reading/writing to the file system. Java applications run standalone, outside the browser. 

To view an applet in the browser, following steps need to be followed:
Compile the applet you have written … the .java file so as to get the .class file.

Then, include the following code in your .html file:


And then open the file using a java enabled browser.

height: Defines height of applet
width: Defines width of applet
align: Defines the text alignment around the applet
alt: An alternate text to be displayed if the browser support applets but cannot run this applet
archive: A URL to the applet when it is stored in a Java Archive or ZIP file
code: A URL that points to the class of the applet
codebase: Indicates the base URL of the applet if the code attribute is relative
hspace: Defines the horizontal spacing around the applet
vspace: Defines the vertical spacing around the applet
name: Defines a name for an applet
object: Defines the resource name that contains a serialized representation of the applet
title: Display information in tool tip

Applet tags have attributes width and height with which we can determine their dimensions.

You can set the background color of an applet in the following manner:

<applet code="MyApplet.class" width="100" height="100">
<param name="background-color" value="#ffffff">
<param name="foreground-color" value="#000000">

‹‹ previous1234567

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: