异常的简单处理

xiaoxiao2021-02-28  126

package packages; public class YiChang { private static void text3(boolean isThiow)throws Exception { // TODO Auto-generated method stub System.out.println("进入text3的世界。。。。"); try{ if(isThiow){ throw new Exception();//在这里 我要把异常扔出去 } }catch(Exception e){ System.out.println("出异常啦,继续给洒家抛出去。。。"); throw e; } System.out.println("异常清理完了"); } public static void main(String[] ages){ try{ text3(true); }catch(Exception e){ System.out.println("还是出错了"); } } }
转载请注明原文地址: https://www.6miu.com/read-39946.html

最新回复(0)