{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Echo - Reads a character string from the user and prints...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // Echo.java Author: Lewis/Loftus // // Demonstrates the use of the nextLine method of the Scanner class // to read a string from the user. //******************************************************************** / import java.util.Scanner; i public class Echo { //-----------------------------------------------------------------
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // Reads a character string from the user and prints it. //-----------------------------------------------------------------public static void main (String args) { String message; Scanner scan = new Scanner (System.in); System.out.println ("Enter a line of text:"); message = scan.nextLine(); System.out.println ("You entered: \"" + message + "\""); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online