0
点赞
收藏
分享

微信扫一扫

跟踪异常传播

q松_松q 2022-06-20 阅读 37

11.8

今天的代码是关于跟踪异常传播:

下面是代码部分:

package lianxi;
import javax.swing.*;
public class bo {

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" );
}
}

 

运行结果:

跟踪异常传播_d3

 

 运行结果分析

代码报错

 


举报

相关推荐

0 条评论