读书人

java中不能捕获错误的有关问题,

发布时间: 2012-02-15 12:09:44 作者: rapoo

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?

读书人网 >J2SE开发

热点推荐