1.自己用try{}catch(){}语句捕获异常并处理。
2.在定义接口的后面写上throw Exception。把异常抛出让使用接口的人处理异常。两种方法都可以。但如果是RuntimeException异常,那就是自己程序某些地方写错了,那你就必须找到并修改程序。