UCSCBaskin School of Engineering  
General Information Events, News & Organizations Degrees & Departments Research Classes Admissions & Advising People & Jobs Administration
CMPS 012A/L - Optional Exercise 1

Echo! Echo!

If you have extra time, try to work on this optional exercise on your own or in lab.

What to do

For this exercise, write a program that simply echoes every line the user enters until the enter a line that is just the word "quit" at which point the program should exit. The program should start by printing "ready" to indicate that it is ready for input.

You should use input.nextLine() to read an entire input line, where input is a reference to a Scanner object.

Here is a sample execution. The user input is in bold.

os-prompt%java Echo
ready
This is a test.
This is a test.
Here is another line.
Here is another line.
quit
os-prompt%

General info · News · Events · Degree Programs · Research · Classes · Admissions · Advising · People · Jobs · Administration
SOE Webmail · SOE SSH · SOE Wiki · Search · Sitemap · Contact us · Driving directions · Privacy · UCSC
© Baskin School of Engineering, University of California, Santa Cruz
1156 High St., Santa Cruz, CA 95064 · (831) 459-2158 · webmaster@soe.ucsc.edu