1.
What is an Applet? Should applets have constructors?
- Applets are small programs transferred through Internet, automatically installed and run as part of web-browser. 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.
2.
What are the Applet’s Life Cycle methods? Explain them? - 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.
3.
What is the sequence for calling the methods by AWT for applets? - 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()
4.
How do Applets differ from Applications? - Following are the main differences: Application: Stand Alone, doesn’t need
web-browser. Applet: Needs no explicit installation on local machine. Can be transferred through Internet on to the local machine and may run as part of web-browser. Application: Execution starts with main() method. Doesn’t work if main is not there. Applet: Execution starts with init() method. Application: May or may not be a GUI. Applet: Must run within a GUI (Using AWT). This is essential feature of applets.
5.
Can we pass parameters to an applet from HTML page to an applet? How? - We can pass parameters to an applet using
search topic
Tuesday, May 13, 2008
Java Applets Technical Interview Test Questions 15
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment