반응형
package hello;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.NoSuchElementException;
import java.util.Scanner;
public class FileInputStreamTest1 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String src = "c:\\windows\\system.ini";
		try {
			Scanner fileScanner = new Scanner(new FileReader(src));
			String line;
			int lineNumber = 1;
			while(fileScanner.hasNext()) {
				line = fileScanner.nextLine();
				System.out.printf("%4d", lineNumber++);
				System.out.println(":" + line);
			}
			fileScanner.close();
		} catch (FileNotFoundException e) {
			System.out.println("파일을 찾을 수 없습니다.");
		} catch (NoSuchElementException e) {
			System.out.println("파일의 끝에 도달하여 읽을 내용이 없습니다.");
		}finally {
			scanner.close();
		}
	}
}
   1:; for 16-bit app support
   2:[386Enh]
   3:woafont=dosapp.fon
   4:EGA80WOA.FON=EGA80WOA.FON
   5:EGA40WOA.FON=EGA40WOA.FON
   6:CGA80WOA.FON=CGA80WOA.FON
   7:CGA40WOA.FON=CGA40WOA.FON
   8:
   9:[drivers]
  10:wave=mmdrv.dll
  11:timer=timer.drv
  12:
  13:[mci]
반응형

+ Recent posts