A good answer might be:

  1. Will this program compile without syntax errors?
    • Yes.
  2. Will this program run?
    • Yes.
  3. Does the program meet the assignment?
    • No—it has a bug.

Longer Example Program

Usually bugs are much more difficult to find than the one in this program. The longer a program is, the more bugs it is likely to have, and the more difficult it is to find them. It is a good idea to practice with short programs where syntax errors and bugs are more easily seen before moving on to longer programs.

Here is a somewhat longer example program:

class Emily
{
  public static void main ( String[] args )
  {
    System.out.println("A bird came down the walk:");
    System.out.println("He did not know I saw;");
    System.out.println("He bit an angle-worm in halves");
    System.out.println("And ate the fellow, raw.");
  }
}

This program should be saved in a file called Emily.java and with it the compiler will create a bytecode file called Emily.class.

QUESTION 9:

What will this program write to the monitor when it is run?