try {
inFile = new Scanner(file);
}
catch (FileNotFoundException e) {
System.out.println("FileNotFoundException");
}
我有这段代码。但是,在try/catch语句后,我有以下几点:帮助try/catch和访问try内的元素
while(inFile.hasNext()) {
}
编译器告诉我,我还没有初始化inFile。我是否需要将所有代码放在try/catch中?我究竟做错了什么?
那么,如果发生异常会发生什么?将`inFile`分配任何东西(可用)? – delnan 2011-02-16 17:50:32