网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
多选题
1. class Synapse { 2. protected int gap() { return 7; } 3. } 4. 5. class Creb extends Synapse { 6. // insert code here 7. } 分别插入到第 6 行,哪三行可以编译?()
A
int gap() { return 7; }
B
public int gap() { return 7; }
C
private int gap(int x) { return 7; }
D
protected Creb gap() { return this; }
E
public int gap() { return Integer.getInteger (42); }
参考答案
参考解析
解析:
暂无解析
更多 “多选题1. class Synapse { 2. protected int gap() { return 7; } 3. } 4. 5. class Creb extends Synapse { 6. // insert code here 7. } 分别插入到第 6 行,哪三行可以编译?()Aint gap() { return 7; }Bpublic int gap() { return 7; }Cprivate int gap(int x) { return 7; }Dprotected Creb gap() { return this; }Epublic int gap() { return Integer.getInteger (42); }” 相关考题
考题
class A { protected int method1(int a, int b) { return 0; } } Which two are valid in a class that extends class A?() A、 public int method1(int a, int b) { return 0; }B、 private int method1(int a, int b) { return 0; }C、 private int method1(int a, long b) { return 0; }D、 public short method1(int a, int b) { return 0: }E、 static protected int method1(int a, int b) { return 0; }
考题
1. class BaseClass { 2. private float x = 1.of; 3. protected float getVar() { return x; } 4. } 5. class SubClass extends BaseClass { 6. private float x = 2.Of; 7. // insert code here 8. } Which two are valid examples of method overriding when inserted at line 7?() A、 float getVar() { return x; }B、 public float getVar() { return x; }C、 public double getVar() { return x; }D、 protected float getVar() { return x; }E、 public float getVar(float f) { return f; }
考题
1. public class A { 2. public void doit() { 3. } 4. public String doit() { 5. return “a”; 6. } 7. public double doit(int x) { 8. return 1.0; 9. } 10.} What is the result?() A、 An exception is thrown at runtime.B、 Compilation fails because of an error in line 7.C、 Compilation fails because of an error in line 4.D、 Compilation succeeds and no runtime errors with class A occur.
考题
1.class SuperFo{ 2. SuperFo doStuff(int x){ 3.return new SuperFo() 4.} 5.} 6. 7.class Foo extends SuperFo{ 8.//insert code here 9.} 和四个声明: Foo doStuff(int x){return new Foo();} Foo doStuff(int x){return new SuperFoo();} SuperFoo doStuff(int x){return new foo();} SuperFoo doStuff(int y){return new SuperFoo();} 分别插入到第8行,有几个可以通过编译 ()A、1B、2C、3D、4E、5
考题
现有: 1. class HorseRadish { 2. // insert code here 3. protected HorseRadish(int x) { 4. System.out.println("bok choy"); 5. } 6. } 7. class Wasabi extends HorseRadish { 8. public static void main(String [] args) { 9. Wasabi w = new Wasabi(); 10. } 11. } 分别插入到第 2 行,哪两项允许代码编译并产生"bok choy" 输出结果?() A、 // just a commentB、 protected HorseRadish() { }C、 protected HorseRadish() { this(42);}D、 protected HorseRadish() { new HorseRadish (42);}
考题
1. class Over{ 2. int doIt(long x) { return 3;} 3. } 4. 5. class Under extends Over{ 6. //insert code here 7. } 和四个方法: short doIt(int y) {return 4;} int doIt(long x,long y){return 4;} private int doIt(Short y){ return 4;} protected int doIt(long x){return 4;} 分别插入到第6行,有几个可以通过编译?() A、2B、3C、4D、0E、1
考题
现有: 1. abstract class Color2 { 2. //insert code here 3. } 4. 5. public class Blue2 extends Color2 { 6.public String getRGB() { return "blue"; } 7. } 和4个声明: public abstract String getRGB(); abstract String getRGB(); private abstract String getRGB(); protected abstract String getRGB(); 分别插入到第2行,有多少行可以编译?() A、 0B、 1C、 2D、 3
考题
现有: 1. class Synapse { 2. protected int gap() { return 7; } 3. } 4. 5. class Creb extends Synapse { 6. // insert code here 7. } 分别插入到第 6 行,哪三行可以编译?()A、 int gap() { return 7; }B、 public int gap() { return 7; }C、 private int gap(int x) { return 7; }D、 protected Creb gap() { return this; }E、 public int gap() { return Integer.getInteger ("42"); }
考题
现有: 1.class Over { 2.int dolt (long x) { return 3; } 3. } 4. 5. class Under extends Over { 6.//insert code here 7. } 和四个方法: short dolt (int y) { return 4; } int dolt(long Xr long y) { return 4; } private int dolt(short y) { return 4; } protected int dolt (long x) { return 4; } 分别插入到第6行,有几个可以通过编译?() A、 1B、 2C、 3D、 4
考题
1. public class Test { 2. public T findLarger(T x, T y) { 3. if(x.compareTo(y) 0) { 4. return x; 5. } else { 6. return y; 7. } 8. } 9. } and: 22. Test t = new Test(); 23. // insert code here Which two will compile without errors when inserted at line 23?() A、 Object x = t.findLarger(123, “456”);B、 int x = t.findLarger(123, new Double(456));C、 int x = t.findLarger(123, new Integer(456));D、 int x = (int) t.findLarger(new Double(123), new Double(456));
考题
1. class SuperFoo { 2. SuperFoo doStuff(int x) { 3. return new SuperFoo(); 4. } 5. } 6. 7. class Foo extends SuperFoo { 8. //insert code here 9. } 下面哪三项分别插入到第8行,可以编译?()A、int doStuff() { return 42; }B、int doStuff(int x) { return 42; }C、Foo doStuff(int x) { return new Foo(); }D、SuperFoo doStuff(int x) { return new Foo(); }
考题
1. abstract class Color2 { 2. //insert code here 3. } 4. 5. public class Blue2 extends Color2 { 6. public String getRGB() { return "blue"; } 7. } 和4个声明: public abstract String getRGB(); abstract String getRGB(); private abstract String getRGB(); protected abstract String getRGB(); 分别插入到第2行,有多少行可以编译?() A、0B、1C、2D、3
考题
现有: 1. abstract class Color { 2.protected abstract String getRGB(); 3. } 4. 5. public class Blue extends Color { 6. //insert code here 7. } 和四个声明: public String getRGB() { return "blue"; } String getRGB() { return "blue"; ) private String getRGB() { return "blue"; } protected String getRGB() { return "blue"; ) 分别插入到第6行,有几个可以通过编译?() A、 0B、 1C、 2D、 3
考题
现有: 1.class SuperFoo{ 2.SuperFoo doStuff (int x) { 3.return new SuperFoo(); 4. } 5. } 6. 7. class Foo extends SuperFoo { 8. //insert code here 9. } 和四个声明: Foo doStuff (int x) { return new Foo(); } Foo doStuff (int x) { return new SuperFoo(); } SuperFoo doStuff(int x) { return new Foo(); } SuperFoo doStuff(int y) { return new SuperFoo(); } 分别插入到第8行,有几个可以通过编泽?() A、 1B、 2C、 3D、 4
考题
1. public class A { 2. public String doit(int x, int y) { 3. return “a”; 4. } 5. 6. public String doit(int... vals) { 7. return “b”; 8. } 9. } Given: 25. A a=new A(); 26. System.out.println(a.doit(4, 5)); What is the result?() A、 Line 26 prints “a” to System.out.B、 Line 26 prints „b” to System.out.C、 An exception is thrown at line 26 at runtime.D、 Compilation of class A will fail due to an error in line 6.
考题
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?() 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, int y) { return 0; }E、 protected int blipvert(long x) { return 0; }F、 protected long blipvert(long x) { return 0; }G、protected long blipvert(int x) { return 0; }
考题
多选题1. class SuperFoo { 2. SuperFoo doStuff(int x) { 3. return new SuperFoo(); 4. } 5. } 6. 7. class Foo extends SuperFoo { 8. //insert code here 9. } 下面哪三项分别插入到第8行,可以编译?()Aint doStuff() { return 42; }Bint doStuff(int x) { return 42; }CFoo doStuff(int x) { return new Foo(); }DSuperFoo doStuff(int x) { return new Foo(); }
考题
多选题Given the following code, which method declarations, when inserted at the indicated position, will not cause the program to fail compilation?() public class Qdd1f { public long sum(long a, long b) { return a + b; } // insert new method declaration here }Apublic int sum(int a, int b) { return a + b; }Bpublic int sum(long a, long b) { return 0; }Cabstract int sum();Dprivate long sum(long a, long b) { return a + b; }Epublic long sum(long a, int b) { return a + b; }
考题
多选题现有: 1. class HorseRadish { 2. // insert code here 3. protected HorseRadish(int x) { 4. System.out.println("bok choy"); 5. } 6. } 7. class Wasabi extends HorseRadish { 8. public static void main(String [] args) { 9. Wasabi w = new Wasabi(); 10. } 11. } 分别插入到第 2 行,哪两项允许代码编译并产生"bok choy" 输出结果?()A// just a commentBprotected HorseRadish() { }Cprotected HorseRadish() { this(42);}Dprotected HorseRadish() { new HorseRadish (42);}
考题
单选题现有: 1. abstract class Color2 { 2. //insert code here 3. } 4. 5. public class Blue2 extends Color2 { 6.public String getRGB() { return "blue"; } 7. } 和4个声明: public abstract String getRGB(); abstract String getRGB(); private abstract String getRGB(); protected abstract String getRGB(); 分别插入到第2行,有多少行可以编译?()A
0B
1C
2D
3
考题
多选题class Sock { String size; String color; public boolean equals(Object o) { Sock s = (Sock) o; return color.equals(s.color); } // insert code here } 哪两个满足 hashCode 的约定?()Apublic int hashCode() { return 343; }Bpublic int hashCode() { return size.hashCode (); }Cpublic int hashCode() { return color.hashCode (); }Dpublic int hashCode() { return (int) (Math.random() * 1000);
考题
多选题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?()Apublic int blipvert(int x) { return 0; }Bprivate int blipvert(int x) { return 0; }Cprivate int blipvert(long x) { return 0; }Dprotected long blipvert(int x, int y) { return 0; }Eprotected int blipvert(long x) { return 0; }Fprotected long blipvert(long x) { return 0; }Gprotected long blipvert(int x) { return 0; }
考题
多选题class A { protected int method1(int a, int b) { return 0; } } Which two are valid in a class that extends class A?()Apublic int method1(int a, int b) { return 0; }Bprivate int method1(int a, int b) { return 0; }Cprivate int method1(int a, long b) { return 0; }Dpublic short method1(int a, int b) { return 0: }Estatic protected int method1(int a, int b) { return 0; }
考题
多选题现有: 1. class Synapse { 2. protected int gap() { return 7; } 3. } 4. 5. class Creb extends Synapse { 6. // insert code here 7. } 分别插入到第 6 行,哪三行可以编译?()Aint gap() { return 7; }Bpublic int gap() { return 7; }Cprivate int gap(int x) { return 7; }Dprotected Creb gap() { return this; }Epublic int gap() { return Integer.getInteger (42); }
考题
多选题1. class BaseClass { 2. private float x = 1.of; 3. protected float getVar() { return x; } 4. } 5. class SubClass extends BaseClass { 6. private float x = 2.Of; 7. // insert code here 8. } Which two are valid examples of method overriding when inserted at line 7?()Afloat getVar() { return x; }Bpublic float getVar() { return x; }Cpublic double getVar() { return x; }Dprotected float getVar() { return x; }Epublic float getVar(float f) { return f; }
考题
多选题class One { public One foo() { return this; } } class Two extends One { public One foo() { return this; } } class Three extends Two { // insert method here } Which two methods, inserted individually, correctly complete the Three class?()Apublic void foo() { }Bpublic int foo() { return 3; }Cpublic Two foo() { return this; }Dpublic One foo() { return this; }Epublic Object foo() { return this; }
考题
单选题现有: 1. abstract class Color { 2.protected abstract String getRGB(); 3. } 4. 5. public class Blue extends Color { 6. //insert code here 7. } 和四个声明: public String getRGB() { return "blue"; } String getRGB() { return "blue"; ) private String getRGB() { return "blue"; } protected String getRGB() { return "blue"; ) 分别插入到第6行,有几个可以通过编译?()A
0B
1C
2D
3
热门标签
最新试卷