Specifications
Sun Services
Java™ Programming Language
Module 9, slide 13 of 37
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Reading From Standard Input
14 try {
15 // Read each input line and echo it to the screen.
16 s = in.readLine();
17 while ( s != null ) {
18 System.out.println("Read: " + s);
19 s = in.readLine();
20 }
21
22 // Close the buffered reader.
23 in.close();
24 } catch (IOException e) { // Catch any IO exceptions.
25 e.printStackTrace();
26 }
27 }
28 }










