-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOtherStreamTest.java
More file actions
47 lines (35 loc) · 1.11 KB
/
Copy pathOtherStreamTest.java
File metadata and controls
47 lines (35 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package tutorial.java;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class OtherStreamTest {
// @Test
// public void test() { // test in
public static void main(String[] args) {
BufferedReader br = null;
try {
InputStreamReader isr = new InputStreamReader(System.in);
br = new BufferedReader(isr);
while(true){
System.out.println("please insert your input chars");
String data = br.readLine();
if("e".equalsIgnoreCase(data) || "exit".equalsIgnoreCase(data)){
System.out.println("program exit");
break;
}
String upd = data.toUpperCase();
System.out.println(upd);
}
}catch (IOException e){
e.printStackTrace();
}finally {
if(br != null){
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}