Given:
1. public class Blip{
2. protected int blipvert(int x){return 0;}
3. }
4. class Vert extends Blip{
5. //insert code here
6. }
Which five methods, inserted independently at line 5, will compile? (Choose
five.)
A. public int blipvert(int x){return 0;}
B. private int blipvert(int x){return 0;}
C. private int blipvert(long x){return 0;}
D. protected long blipvert(int x){return 0;}
E. protected int blipvert(long x){return 0;}
F. protected long blipvert(long x){return 0;}
G. protected long blipvert(int x, int y){return 0;}
答案B跟D错 ACEFG对
B是因为继承的方法权限只能更开放,故不能用private
但明明C也是private阿,为什么C对?
D是因为overriding回传型态要跟父类别相同
但明明F/G也改了回传型别,为什么对?