Tags as Containers

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.
go to previous page   go to home page   go to next page        

Answer:

Hopefully, it worked. (If your browser does not have Javascript enabled, it will not work.)

Tags as Containers

Some HTML tags come in matched pairs that act as containers for a section of text. If tag like <something> has a matching tag, the matching tag will look like </something>.

For example, a paragraph of text is "bracketed" by the tags <p> and </p>  .

Most browsers are very forgiving and let you get away with grammatically poor HTML. For example, you can usually omit the ending tag </p> of the paragraph pair. But is is a poor idea to do so, because as HTML becomes more complicated (as it will) browsers and other applications will require following the rules.

QUESTION 5:

Is the following text one paragraph or two?

<p>
I had called upon my friend Sherlock Holmes upon
the second morning after Christmas, with the intention
of wishing him the compliments of the season.

He was lounging upon the sofa in a purple 
dressing-gown, a pipe-rack within his reach upon 
the right, and a pile of crumpled morning papers, 
evidently newly studied, near at hand.
</p>