[問題] Exception的問題
程式碼大致如下
=====================================================================
public class Translator extends Loader{
public static void main(String args[]) throws Exception{
new Translator().Translator();
}
public void Translator() throws Exception{
try{
......
unit(refPath);
......
moveFile(refPath,array[i]);
......
}catch(IOException e){
throw new IOException(e.getMessage());
}catch(SQLException e){
throw new SQLException(e.getMessage());
}catch(Exception e){
throw new Exception(e.getMessage());
}finally{
.........
}
}
public void unit(String refPath) throws Exception{
try{
......
}catch(Exception e){
throw new Exception(e.getMessage());
}
}
public void moveFile(String refPath,String limitFile) throws IOException{
try{
.......
}catch(IOException ie){
throw new IOException(ie.getMessage());
}
}
}
=========================================================================
出現unreported exception java.lang.Exception; must be caught or declared to be thrown
我有catch到IOException、SQLException、Exception
但是還是會出現這樣的錯誤訊息
請問為什麼呢
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.126.44.149
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
java 近期熱門文章
PTT數位生活區 即時熱門文章