println()

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.

Answer:

public    static void main(String[] args)

The Java compiler would accept the line. But it looks sloppy to human eyes.

println()

Here is the example program again:

class Hello
{
  public static void main ( String[] args )
  {
    System.out.println("Hello World!");
  }
}

The main method of this program consists of a single statement:

System.out.println("Hello World!");

This statement writes the characters inside the quotation marks to the monitor of the computer system. (The quotation marks are not written.)

The part "Hello World!" is called a string. A string is a sequence of characters. This program writes a string to the monitor and then stops.

QUESTION 4:

(Review: ) Say that the file Hello.java contains the example program. The file is contained in the subdirectory C:/Temp on the hard disk. In order to run it, what two things must be done?