|
发表于 2004-4-6 15:41:49
|
显示全部楼层
re
java吧!!这个好
package exception;
import java.lang.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
//构造用户界面不写了
try
{
byte[] tmpData = new byte[1];
FileInputStream in = new FileInputStream("/home/yzq/data/poem.txt");
while(in.read(tmpData) != -1)
{
System.out.print(new String(tmpData));
}
System.out.print("\n");
}
catch(FileNotFoundException ecp)
{
JOptionPane.showMessageDialog(null,"没发现文件,请检查路径是否正确");
}
catch(IOException ecp)
{
JOptionPane.showMessageDialog(null,"I/O致命错误");
}
finally
{
try
{
in.close();
}
catch(IOException ecp)
{
ecp.printStackTrace();
}
}
感觉oracle中的异常处理方式差不多 |
|