Pre-formatted text

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:

Try it and see!

Pre-formatted text

Sometimes you don't want a paragraph to be automatically formatted by the browser. For example, look at the following:

<p>
import java.io.*;
class Echo
{
  public static void main (String[] args) throws IOException
  {
    BufferedReader stdin = 
        new BufferedReader ( new InputStreamReader( System.in ) );

    String inData;

    System.out.println("Enter the data:");
    inData = stdin.readLine();

    System.out.println("You entered:" + inData );
  }
}
</p>

This will come out like this:

import java.io.*; class Echo { public static void main (String[] args) throws IOException { BufferedReader stdin = new BufferedReader ( new InputStreamReader( System.in ) ); String inData; System.out.println("Enter the data:"); inData = stdin.readLine(); System.out.println("You entered:" + inData ); } }

The browser made a nice, neat paragraph of that text. Not what you want. To tell the browser that a block of text is pre-formatted use the tags <pre> ... </pre>.

QUESTION 19:

What other types of text (besides programs) might require pre-formatting?