2024-11-11


한 줄을 입력하세요...
abcdefg
abcdefg
package basic;
import java.io.IOException;
import java.io.InputStream;
public class FileIO_02 {
public static void main(String[] args) {
System.out.println("한 줄을 입력하세요...");
try {
while (true) {
//InputStream is = System.in;
//int readByte = is.read();
int readByte = System.in.read(); // 위와 동일
if (readByte == '\n') { // enter 키를 사용하면
break;
}
System.out.print((char)readByte);
} // while 반복문 end
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}'Java > 기초 내용 정리' 카테고리의 다른 글
| Java(IO)_04 (0) | 2024.11.11 |
|---|---|
| Java(IO)_03 (0) | 2024.11.11 |
| Java(IO)_01 (0) | 2024.11.11 |
| Java(GUI)_Event_35 (1) | 2024.11.08 |
| Java(GUI)_Event_34 (0) | 2024.11.08 |