以下程序运行的输出结果是class BusinessExcept...
发布于 2022-03-03 17:16:27
以下程序运行的输出结果是
class BusinessException extends Exception{}
class SubBusinessException extends BusinessException{}
public class Test {
public static void main(String[] args) {
System.out.print(testException())
}
public static String testException() {
try {
try {
throw new SubBusinessException()
} catch (BusinessException re) {
return "桔子"
} finally {
throw new BusinessException()
}
} catch (SubBusinessException re) {
System.out.print("捕获SubBusinessException")
} catch (BusinessException re) {
System.out.print("捕获BusinessException")
} finally {
return "乐信"
}
}
}
class BusinessException extends Exception{}
class SubBusinessException extends BusinessException{}
public class Test {
public static void main(String[] args) {
System.out.print(testException())
}
public static String testException() {
try {
try {
throw new SubBusinessException()
} catch (BusinessException re) {
return "桔子"
} finally {
throw new BusinessException()
}
} catch (SubBusinessException re) {
System.out.print("捕获SubBusinessException")
} catch (BusinessException re) {
System.out.print("捕获BusinessException")
} finally {
return "乐信"
}
}
}
登录后免费查看答案
关注者
0
被浏览
11