What does the program print on the monitor when it runs?

A good answer might be:

The variable contains: 123

Simulated Java Program

To get the most out of these notes, copy the program to NotePad (or other text editor), save it to a file called "example.java" , compile and run it with Java. See Chapter 7. For a simulation of running the program, enter an integer in the text box below and click on "Compile", then click on "Run". (Note: if this does not work, your browser does not have JavaScript enabled.)


class example
{
  public static void main ( String[] args )
  {
    long payAmount = ;    //integer literal

    System.out.println("The variable contains: " + payAmount );
  }
}

Simulated Monitor




This is just a simulation (using JavaScript), so it is not exactly like a compiling and running a real Java program. Don't take it too seriously. Please do the real thing if you can.

QUESTION 4:

Try entering something like "rats" instead of an integer literal. Does the program compile successfully?