Java Reference
In-Depth Information
Answers to Review Questions
1.
code, width, and height.
2.
An applet must extend applet. An Applet class can also extend JApplet because JApplet
is a child of Applet; therefore, the answer is e.
3.
False. An Applet class can define main(), but it will not be invoked by the browser.
4.
The methods invoked when an applet is initialized are init(), start(), and paint(), in that
order.
5.
False. The bytecode can reside anywhere, and the HTML can denote the location of
the applet's bytecode using the codebase attribute of the <applet> tag.
6.
True. The size of an applet is based on the width and height attributes of the <applet> tag.
7.
False. Selecting Stop in a browser stops the page from downloading further, but has
no effect on an applet that is already running on the page.
8.
The getParameter() method of the Applet class.
9.
By nesting the <param> tag within the <applet> tag of the corresponding HTML page.
10.
True. That is the purpose of the getCodeBase() method.
11.
True. That is the purpose of the getDocumentBase() method.
12.
False. By default, an applet cannot access local files; however, the security permissions
can be changed for an applet so that it can step outside of the sandbox and perform
tasks such as accessing local files.
13.
By invoking the getAppletContext() method in the Applet class.
14.
True. In fact, this is commonly done.
15.
False. You do not need to use JAR files with applets; however, using JAR files greatly
reduces the risk of files not being found or classes not being loaded properly on the
client's machine.
Search WWH ::




Custom Search