- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadLines.java
More file actions
Latest commit
21 lines (19 loc) · 571 Bytes
/
Copy pathReadLines.java
File metadata and controls
21 lines (19 loc) · 571 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Reading strings from the console
importjava.io.*;
classReadLines {
publicstaticvoidmain(String[] args)
throwsIOException {
// String placeholder
StringaStr;
// reader object
BufferedReaderaReader
= newBufferedReader(newInputStreamReader(System.in));
// Read some strings from the console via readline
System.out.println("Write something nice and it will be copied.");
System.out.println("Say 'stop' and it will be over:");
do {
aStr = aReader.readLine();
System.out.println(aStr);
} while (! aStr.equals("stop"));
}
}