java中不能捕获异常的问题,急!!!!
class Excep
{
public int fn1(int a,int b)
{
return a/b;
}
}
class Exceptext
{
public static void main(String [] args)
{
Excep excep = new Excep();
try
{
excep.fn1(5,0);
}
catch(Exception e)
{
System.out.println( "1 ");
}
System.out.println( "1 ");
}
}
为什么会提示以下错误:
.\Exception.java:1: duplicate class: Excep
class Excep
^
.\Exception.java:17: duplicate class: Exceptext
class Exceptext
^
Excep.java:18: cannot access Exception
bad class file: .\Exception.java
file does not contain class Exception
Please remove or make sure it appears in the correct subdirectory of the classp
th.
catch(Exception e)
^
3 errors
------解决方案--------------------当前目录已经存在Excep.class?