有名大站 » Blog Archive » JAVA-CustomException

JAVA-CustomException

package exception;

class CustomException extends Exception{
public CustomException(){
    super("自訂例外");
}
public CustomException(String msg){
    super(msg);
}
}

public class TestCustomException{
public static void main(String [] args){

try{
  throw new CustomException();
}catch (CustomException ce ){
ce.printStackTrace();
}
}
}

1則回覆

  1. 2009/03/02 at 08:12
    berlin 說 :

    Gut!

給個回覆

使用Facebook帳號留言

支持FaceBook帳戶留言,歡迎多加利用

E-Mail (不會被公開) (支援Gravatar大頭貼)

:az: :ay: :ax: :aw: :av: :au: :at: :as: :ar: :aq: :ap: :ao: :an: :am: :al: :ak: :aj: :ai: :ah: :ag: :af: :ae: :ad: :ac: :ab: :aa:

« 上一篇文章
»下一篇文章