现有[br][/br] public class Parent{[br][/br] public void change (int x){[br][/br] }[br][/br] }[br][/br] public class Child extends Parent{[br][/br] //覆盖父类change方法[br][/br] }[br][/br]下列哪个声明是正确的覆盖了父类的change方法
A: protected void change (int x){}
B: public void change(int x, int y){}
C: public void change (int x){}
D: public void change (String s){}
A: protected void change (int x){}
B: public void change(int x, int y){}
C: public void change (int x){}
D: public void change (String s){}
举一反三
- 现有 public class Parent{ public void change (int x){ } } public class Child extends Parent{ //覆盖父类change方法 }下列哪个声明是正确的覆盖了父类的change方法? A: protected void change (int x){} B: public void change(int x, int y){} C: public void change (int x){} D: public void change (String s){}
- public class Parent{ public void change(int x){} } public class Child extends Parent{ //覆盖父类change方法 } 下列哪个声明是正确的覆盖了父类的change方法?() A: protected void change(int x){} B: public void change(int x, int y){} C: public void change(String s){} D: public void change(int x){}
- public class Parent {[br][/br] int change() {…}[br][/br]}[br][/br]class Child extends Parent {[br][/br]}[br][/br]哪些方法可被加入类Child A: public int change(){} B: int chang(int i){} C: private int change(){} D: abstract int chang(){}
- 现有 public class Parent{ public void change (int x){ …… } public class Child extends Parent{ //覆盖父类change方法 } 下列哪个声明是正确的覆盖了父类的change方法?
- public class Parent{ public void change (int x){} } public class Child extends Parent{ //覆盖父类change方法 } 下列哪个声明是正确的覆盖了父类的change方法?