java在catch子句中使用异常实例
public class ExceptionObject {
public static void main(String[] args)
{
Exception exceptionObj = new Exception();
int a=1, b=0;
try
{
int c=a/b;
}
catch(exceptionObj)
{
exceptionObj.printStackTrace();
}
}
}
为什么我不能使用“exceptionObj”,它是catch子句中类Exception的一个实例。 请告知,会有帮助的
# 1 楼答案
您可以尝试以下方法: