//문자 테스트(2byte)
package jp03.part0415.study;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
public class ReaderTest {
/**
* @param args
*/
public ReaderTest(){
try {
InputStream is = System.in;
Reader rd = new InputStreamReader(is); //다형성
System.out.println("입력을 기다립니다....");
while(true){
int i = rd.read();
char c = (char)i;
System.out.println("입력하신 값 : " + c);
if(c == 'x'){
rd.close();
break;
}
}
} catch (IOException e) {
// TODO: handle exception
e.printStackTrace();
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new ReaderTest();
}
}
[결과]
'프로그램 > Java & Jsp' 카테고리의 다른 글
Java IO - (5) -> [FileReader] (0) | 2008.08.20 |
---|---|
Java IO - (4) -> [FileInputStream] (0) | 2008.08.20 |
Java IO - (3) -> [Writer] (0) | 2008.08.20 |
Java IO - (1) -> [InputStream] (0) | 2008.08.20 |
Beans, DTO, DAO (0) | 2008.08.18 |