08/03/15 15:32:42
import java.io.*;
class hoge{
public static void main(String args[]){
if(args.length <= 0){
System.out.println("specify the file name correctly");
System.exit(1);
}
try{
int i;
for(i = 0; i < args.length; i++){
BufferedReader br = new BufferedReader(new FileReader(args[i]));
String str;
while((str = br.readLine()) != null){
System.out.println(str);
}
}
br.close();
}
catch(IOException e){
System.out.println("input/output error");
}
}
}
コマンドライン引数からファイルを受け取って表示するプログラムですが、
br.close()の行で "シンボルを解決できない" というエラーが出ます。なぜエラーが出るのかわかりません。
br.close()を削除すれば実行できるのですが・・・。