首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

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

2012-02-15 
java中不能捕获异常的问题,急!!!!classExcep{publicintfn1(inta,intb){returna/b}}classExceptext{public

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?

热点排行