Programming and Problem Solving with Java

(やまだぃちぅ) #1
14.3 H o w D o Y o u R u n a n Applet? | 669

Factorial


Figure 14.3 shows the HTML document that has the link to the Bytecode version of FactInt.
Although this chapter will not try to teach you HTML, we do want to point out the features
that cause the execution of the applet.Tags are enclosed in angled brackets and are not case-sen-
sitive. Most of them come in pairs, with the second or closing tag preceded by a “/”. At the be-
ginning and the end of the document, you will see ... ; at the beginning and the
end of the title, you will see ... .The body of the HTML code is enclosed in
... .

...

indicates that the information between the tags is a type 1 head-
ing, and

...

encloses a paragraph.
inserts a horizontal rule (line) and has no end-
ing tag.
The following HTML code runs the applet:



Between <APPLETand lie the keywords that cause the applet to be executed. The JVM
starts executing the Bytecode at the file FactInt.class. The applet is in an event loop that keeps
executing as long as the browser remains on the Web page containing the applet.


Figure 14.3 An HTML Document That Causes the Applet FactIntto be Executed




Factorial Labs


Factorial with Int Result


Enter increasing values beginning with 0 and record the results of the factorial of
your input. At some point, the answer will seem strange. Record what seems strange about
the answer and return to the previous page.






Free download pdf