java 重写,父类不抛异常,子类抛异常,为什么不可以?

[code="java"]public class Panda extends Base{
//报错如下:
// Multiple markers at this line
// - overrides com.xb.Base.amethod
// - Exception Exception is not compatible with throws clause in
// Base.amethod(int)
public void amethod(int i) throws Exception{}
}

class Base
{
public void amethod(int i){}
}[/code]

这就是java的重写规则。
对于异常重写方法不能抛出新的异常或者比被重写方法声明的检查异常更广的检查异常。但是可以抛出更少,更有限或者不抛出异常。

楼主采纳的答案跟没说有啥区别?

http://chenjingbo.iteye.com/blog/1145415

有兴趣看看Java方法分派的知识,多看几遍,看懂了就能解释了.