≪Java≫ ファイル入力(読み込み) サンプル
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.FileNotFoundException;
public class Test {
public static void main(String[] args) {
try{
BufferedReader br = new BufferedReader(new FileReader(“word.txt”));
String str;
while((str=br.readLine())!=null){
System.out.println(str);
}
br.close();
}catch(FileNotFoundException e){
System.err.println(“ファイルオープンエラー”);
}catch(IOException e){
System.err.println(“データを読み込みエラー”);
}
}
}