Output

The simplest way a program can communicate with its user is to print data on the screen.

  • The computer screen is called the standard output device ("standard out").

      System.out.println("You were " + age + " in 2010.");
    

  • Error messages are usually sent to the standard error device. This is also your computer screen, but could be set to a text file.

      System.err.println("Your age cannot be negative!");
    


Prev -- Up -- Next