while(first_file.exists())
{
RandomAccessFile first_filef=new RandomAccessFile(first_file,"r");
while((a=first_filef.read(bueff))!=-1)
{
filedd.write(bueff,0,a);
}
first_filef.close();
qkl++;
first_file=new File(file_direction,right2_name+Integer.toString(qkl));
}
filedd.close();
}
catch(FileNotFoundException ee1)
{
JOptionPane.showMessageDialog(null,"第" + qkl + "个文件不存在","提示",2);
}
catch(IOException ee2)
{
JOptionPane.showMessageDialog(null,"第" + qkl + "个文件不存在","提示",2);
}
我这里存在文件是只有xxx1,xxx2,按理解,
当我File(../xxx3)的时候,因为文件不存在应该回提示 catch(FileNotFoundException ee1)里的语句,RandomAccessFile first_filef=new RandomAccessFile(first_file,"r");也该会执行catch(IOException ee2)里的语句,为什么没有执行呢,这里没有异常吗???
{
RandomAccessFile first_filef=new RandomAccessFile(first_file,"r");
while((a=first_filef.read(bueff))!=-1)
{
filedd.write(bueff,0,a);
}
first_filef.close();
qkl++;
first_file=new File(file_direction,right2_name+Integer.toString(qkl));
}
filedd.close();
}
catch(FileNotFoundException ee1)
{
JOptionPane.showMessageDialog(null,"第" + qkl + "个文件不存在","提示",2);
}
catch(IOException ee2)
{
JOptionPane.showMessageDialog(null,"第" + qkl + "个文件不存在","提示",2);
}
我这里存在文件是只有xxx1,xxx2,按理解,
当我File(../xxx3)的时候,因为文件不存在应该回提示 catch(FileNotFoundException ee1)里的语句,RandomAccessFile first_filef=new RandomAccessFile(first_file,"r");也该会执行catch(IOException ee2)里的语句,为什么没有执行呢,这里没有异常吗???
可能是 first_file.exists() 已经判断了文件是否存在的缘故!!!!
感谢