抛出异常,常和Try搭配使用,也可单独使用

解决方案 »

  1.   

    So,how do we know that some method throws an exception that we have to catch?
    Just as a method must specify what type and how many arguments it accepts and what is returned,the exception that a method can throw must be specified.the list of thrown exceptions is part of a method's public interface.The throws keyword is uned as follows to list the exceptions that a method can throw:void  myFuntion() throws MyException1,MyException2{
    //code for the method here
    }
      

  2.   

    http://www.csdn.net/Expert/topic/481/481763.shtm