class Test
{ int devide(int x,int y)
{
int reslut=0;
reslut=x/y;
return x/y;
}
}
class TestException
{
public static void main(String [] args)
{
try
{
int reslut=new Test().devide(3,1);
System.out.println(reslut);
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
System.out.println("programe is running here,that is nomare"); }
}--------------------配置: <默认>--------------------
F:\4\TestException.java:20: incompatible types
found   : Exception
required: java.lang.Throwable
                catch(Exception e)
                      ^
F:\4\TestException.java:22: cannot resolve symbol
symbol  : method getMessage ()
location: class Exception
                        System.out.println(e.getMessage());
                                            ^
2 errors处理已完成。

解决方案 »

  1.   

    你的Exception有问题
    重装下JDK看看
      

  2.   

    估计是你在这个目录下(或者说当前包下)自己写了个名叫Exception的类。
    自己写的类,名字最好不要个java.lang包底下的类重名,否则出了错,你都不好查。除非你确实知道自己在做什么。
      

  3.   

    我测了下,你的程序没有问题,
    还是重新安装jdk吧,省事方便
      

  4.   

    javafreshfish? 我估计楼主的jdk安装的没有任何问题! 你有点判断失误吧!
    至于编译出错的原因,我已经在我的上一个回复里写了,仔细看看吧。
      

  5.   

    manbaum 我的确做了测试,没问题,代码运行正常
      

  6.   

    To javafreshfish 
    你怎么试的?你试过在同一个包下另写一个Exception类了?请再试一下。