O'Reilly logo

Java™ How To Program (Early Objects), Tenth Edition by Harvey Deitel, Paul Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.5.5 Prompting the User for Input

Line 17

System.out.print("Enter first integer: "); // prompt

uses System.out.print to display the message "Enter first integer: ". This message is called a prompt because it directs the user to take a specific action. We use method print here rather than println so that the user’s input appears on the same line as the prompt. Recall from Section 2.2 that identifiers starting with capital letters typically represent class names. Class System is part of package java.lang. Notice that class System is not imported with an import declaration at the beginning of the program.

Image Software ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required