'scanner'에 해당되는 글 1건
[05.04] 수업 내용 - I/O :: 2007/05/04 10:14
오늘 내용은 입출력에 대한 필수 사항이므로 암기 요망!!
1. Ex01 - Print from input str, int
import java.io.*;
public class Ex01 {
public static void main(String[] args) throws IOException {
// 입력 클래스
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
// 출력 클래스
OutputStreamWriter osw = new OutputStreamWriter(System.out);
BufferedWriter bw = new BufferedWriter(osw);
PrintWriter pw = new PrintWriter(bw);
pw.print("문자열 : ");
pw.flush();
String str = br.readLine();
pw.println(str);
pw.flush();
pw.print("숫자 : ");
pw.flush();
int num = Integer.parseInt(br.readLine());
pw.println(num);
pw.close();
br.close();
}
}
2. Ex22 - Print from File
more..
3. Ex03 - Use Scanner Class
more..
※ next(): Finds and returns the next complete token from this scanner.



