下列哪个函数是对父类Demo的函数show的正确覆盖class Demo{ int show(int a,int b){ return 0; } }
A: private int show(int a,int b){
return 0;
}
B: public int show(int a,int b){
return 0;
}
C: static int show(int a,int b){
return 0;
}
D: public int show(int a,long b){
return 0;
}
A: private int show(int a,int b){
return 0;
}
B: public int show(int a,int b){
return 0;
}
C: static int show(int a,int b){
return 0;
}
D: public int show(int a,long b){
return 0;
}
举一反三
- Which five methods,inserted independently at line 5,will compile?() 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 int blipvert(long x){return 0;} E: protected long blipvert(long x){return 0;} F: protected long blipvert(int x, int y){return 0;}
- Given: Which five methods, inserted independently at line 5, will compile?() A: protected int blipvert(long x) { return 0; } B: protected long blipvert(int x) { return 0; } C: private int blipvert(long x) { return 0; } D: private int blipvert(int x) { return 0; } E: public int blipvert(int x) { return 0; } F: protected long blipvert(long x) { return 0; } G: protected long blipvert(int x, int y) { return 0; }
- Given: Which five methods, inserted independently at line 5, will compile?() 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; }
- 下面类的索引定义或使用正确的是()。 A: class MyClass{ int x; int y; public int this[int index] { get{ if (index==0) return x; else return y; }}} B: class MyClass{ int x; int y; public int this[int index] { set{ if (index==0) x=value; else y=value; }}} C: class MyClass{ int x; int y; public int INDEX[int index] { get{ if (index==0) return x; else return y; } set{ if (index==0) x=value; else y=value; }}} D: class MyClass{ int x; int y; public int this[int index] { get{ if (index==0) return x; else return y; } set{ if (index==0) x=value; else y=value; }}}
- 以下的类(接口)定义中正确的是( ) A: public class A{ private int x; public getX(){ return x; }} B: public abstract class A{ private int x; public abstract int getX(); public int aMethod(){ return 0; }} C: public class A{ private int x; public abstract int getX();} D: public interface interfaceA{ private int x; public int getX(){ return x; }}