Wednesday 4 February 2015

Java Applet Programming Interview Questions and Answers (Part2)

6. How will you communicate between two Applets?
The simplest method is to use the static variables of a shared class since there's only one instance of the class and hence only one copy of its static variables. A slightly more reliable method relies on the fact that all the applets on a given page share the same AppletContext. We obtain this applet context as follows:
AppletContext ac = getAppletContext();
AppletContext provides applets with methods such as getApplet(name), getApplets(),getAudioClip, getImage, showDocument and showStatus().

7. When is update method called?
Whenever a screen needs redrawing (e.g., upon creation, resizing, validating) the update method is called. By default, the update method clears the screen and then calls the paint method, which normally contains all the drawing code.

8. Which method is used to output a string to an applet? Which function is this method included in?
drawString( ) method is used to output a string to an applet. This method is included in the paint method of the Applet.

9. What are the steps involved in Applet development?
Following are the steps involved in Applet development:
? Create/Edit a Java source file. This file must contain a class which extends Applet class.
? Compile your program using javac
? Execute the appletviewer, specifying the name of your applet?s source file or html file. In case the applet information is stored in html file then Applet can be invoked using java enabled web browser.

10. What are the Applets information methods?
The following are the Applet?s information methods: getAppletInfo() method: Returns a string describing the applet, its author, copyright information, etc. getParameterInfo( ) method: Returns an array of string describing the applet?s parameters.
More Questions & Answers :-
Part1  Part2  Part3  Part4  Part5

No comments:

Post a Comment