如果我把
byte
改成int
,就会出现编译错误。你能解释一下问题吗?public class A {
protected int xy(int x) { return 0; }
}
class B extends A {
protected long xy(int x) { return 0; } //this gives compilor error
//protected long xy(byte x) { return 0; } // this works fine
}
A.xy
的方法签名与B.xy
相同:名称相同,参数数量相同且参数类型相同。 - Jeroen Vannevelint
和byte
并不相同。 - Germann Arlington