Other HTML Tags

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
Historical topic: Java appletsModern web browsers do not run Java applets. The Applet API was deprecated for removal before Java 25 and was removed in Java 26. Treat applet examples on this page as historical object-oriented/GUI examples; for new desktop interfaces use Swing where appropriate or JavaFX/OpenJFX.

Answer:

<html>
<body>
<h3>Here is an Exciting JApplet</h3>
<p>
And what an exciting applet it is.
With a width of 300 pixels, and a height of 150 pixels,
this applet has it all.
</p>
<applet code="AnotherHello.class"  width="300" height="150">
</applet>
</body>
</html>

Other HTML Tags

Tags do not have to start in column one as they do in the example, but doing so is often convenient. The following works the same as the above answer:

<html><body>
<h3>Here is an Exciting JApplet</h3><p>
And what an exciting applet it is. With a width of 300 pixels, and a height of 150 pixels,
this applet has it all.</p>
<applet code="AnotherHello.class" width="300" height="150"> </applet>
</body></html>

The old standards for HTML allowed tags to be upper or lower case. Usually upper case tags will still work, but the recent standard calls for all lower case tags. Here is a list of a few HTML tags. (For more on HTML see Appendix A or search the Web for a more comprehensive tutorial.)

<html> mark the START of a "html" file. These should be the FIRST characters in the file.
</html> mark the END of a "html" file. These should be the LAST characters in the file.
<head> mark the start of the head of the file. The head of the file contains descriptions and declarations that are not supposed to be directly visible on the Web page.
</head> mark the end of the head of the file.
<title> give a title to the entire page (the Web browser can use the title for whatever purpose it wishes.) This should be in the head section of the page.
</title> end of the title.
<body> mark the start of the body of the file. The body of the file is the main part that is visible on the monitor screen.
</body> mark the end of the body of the file.
<hr> a horizontal rule: a line completely across the screen. There is no matching tag.

Here is a larger version of the Web page that uses all these tags:

<html>
<head>
<title>An Exciting Title</title>
</head>

<body>
<h3>Here is an Exciting JApplet</h3>
<p>
And what an exciting applet it is.
With a width of 300 pixels, and a height of 150 pixels,
this applet has it all.
</p>
<applet code="AnotherHello.class"  width="300" height="150">
</applet>
<hr>
</body>
</html>

If you forget to include the match to a tag, you may get strange results. For example, if you forget the </h3> that matches the <h3> tag, the rest of the file will be displayed as a heading. This will look odd.

QUESTION 12:

What do you suppose happens if you forget the match to a <head> tag?