【发布时间】:2015-11-26 07:16:33
【问题描述】:
我有以下代码:
class Exception
{
public static void main(String args[])
{
int x = 10;
int y = 0;
int result;
try{
result = x / y;
}
catch(ArithmeticException e){
System.out.println("Throwing the exception");
throw new ArithmeticException();
}
}
}
类的名称是“异常”。这与默认导入程序的 java.lang.Exception 相同。那么为什么这个程序编译时会使用两个实际上同名的类呢?
【问题讨论】:
-
它正在我的系统上编译