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: 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; }
举一反三
- 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; }
- 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;}
- 如果要实现计算x绝对值的功能,下面程序有错误的是? A: int fun(int x){ if(x<0) return -x;<br> return x; } B: int fun(int x){ if(x<0) return -x;<br> else return x; } C: int fun(int x){ if(x<0) return -x;<br> if(x>0) return x; } D: int fun(int x){ if(x<0) return -x;<br> else if(x==0) return x; else return x; }
- 下列哪个函数是对父类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: 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; }}}