码迷,mamicode.com
首页 > 其他好文 > 详细

如何跟踪异常的传播路径?

时间:2019-11-03 22:02:34      阅读:87      评论:0      收藏:0      [点我收藏+]

标签:异常   rgs   class   row   ack   upload   exce   print   路径   

package we;
public class PrintExceptionStack {
public static void main( String args[] )
{
 try {
    method1();
 }
 catch ( Exception e ) {
    System.err.println( e.getMessage() + "\n" );
    e.printStackTrace();
 }
}

public static void method1() throws Exception
{
 method2();
}

public static void method2() throws Exception
{
 method3();
}

public static void method3() throws Exception
{
 throw new Exception( "Exception thrown in method3" );
}
}

技术图片

 

如何跟踪异常的传播路径?

标签:异常   rgs   class   row   ack   upload   exce   print   路径   

原文地址:https://www.cnblogs.com/yyl141/p/11789329.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!