网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
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

2

B

3

C

4

D

0

E

1


参考答案

参考解析
解析: 暂无解析
更多 “单选题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. public class ReturnIt {  2. return Type methodA(byte x, double y) {  3. return (long)x / y * 2;  4. }  5. }  What is the narrowest valid returnType for methodA in line2?()  A、 intB、 byteC、 longD、 shortE、 floatF、 double

考题 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 Target {  2. private int i = 0;  3. public int addOne() {  4. return ++i;  5. }  6. }  And:  1. public class Client {  2. public static void main(String[] args) {  3. System.out.println(new Target().addOne());  4. }  5. }  Which change can you make to Target without affecting Client?() A、 Line 4 of class Target can be changed to return i++;B、 Line 2 of class Target can be changed to private int i = 1;C、 Line 3 of class Target can be changed to private int addOne() {D、 Line 2 of class Target can be changed to private Integer i = 0;

考题 1. public interface A {  2. public void doSomething(String thing);  3. }  1. public class AImpl implements A {  2. public void doSomething(String msg) { }  3. }  1. public class B {  2. public A doit() {  3. // more code here  4. }  5.  6. public String execute() { 7. // more code here  8. }  9. }  1. public class C extends B {  2. public AImpl doit() {  3. // more code here  4. }  5.  6. public Object execute() {  7. // more code here  8. }  9. }  Which statement is true about the classes and interfaces in the exhibit?() A、 Compilation will succeed for all classes and interfaces.B、 Compilation of class C will fail because of an error in line 2.C、 Compilation of class C will fail because of an error in line 6.D、 Compilation of class AImpl will fail because of an error in line 2.

考题 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 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. 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. public class returnIt (  2. returnType methodA(byte x, double y) (  3. return (short) x/y * 2;  4. )  5. )   What is the valid returnType for methodA in line 2?()  A、 IntB、 ByteC、 LongD、 ShortE、 FloatF、 Double

考题 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. public class ReturnIt {  2. return Type methodA(byte x, double y) {  3. return (short)x / y * 2;  4. }  5. }  What is the narrowest valid returnType for methodA in line2?()  A、 intB、 byteC、 longD、 shortE、 floatF、 double

考题 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 returnIt (  2. returnType methodA(byte x, double y) (  3. return (short) x/y * 2;  4. )  5. )   What is the valid returnType for methodA in line 2?()A  IntB  ByteC  LongD  ShortE  FloatF  Double

考题 多选题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; }

考题 多选题Given: Which five methods, inserted independently at line 5, will compile?()Aprotected int blipvert(long x) { return 0; }Bprotected long blipvert(int x) { return 0; }Cprivate int blipvert(long x) { return 0; }Dprivate int blipvert(int x) { return 0; }Epublic int blipvert(int x) { return 0; }Fprotected long blipvert(long x) { return 0; }Gprotected long blipvert(int x, int y) { 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(); }

考题 单选题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 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.

考题 多选题Given:  1. public class Method Over {  2. public void set Var (int a, int b, float c) {  3. }  4. }   Which two overload the set Var method()?Aprivate void set Var(int a, float c, int b) {}Bprotected void set Var(int a, int b, float c) {}Cpublic int set Var(int a, float c, int b) {return a:}Dpublic int set Var(int a, int b, float c) {return a:}Eprotected float set Var(int a, int b, float c) {return c:}

考题 多选题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); }

考题 多选题Given:  1.  public class ConstOver {  2.  public constOver(int x, int y, int z) {  3.  }  4.  }   Which two overload the ConstOver Constructor?()AConstOver() {}Bprotected int ConstOver(){}Cprivate ConstOver(int z, int y, byte x ) {}Dpublic Object ConstOver(Int x, int y, int z) {}Epubic void ConstOver (byte x, byte y, byte z) {}

考题 单选题1. public class ReturnIt {  2. return Type methodA(byte x, double y) {  3. return (short)x / y * 2;  4. }  5. }  What is the narrowest valid returnType for methodA in line2?()A  intB  byteC  longD  shortE  floatF  double

考题 单选题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 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. 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; }

考题 单选题1. public class ReturnIt {  2. return Type methodA(byte x, double y) {  3. return (long)x / y * 2;  4. }  5. }  What is the narrowest valid returnType for methodA in line2?()A  intB  byteC  longD  shortE  floatF  double

考题 多选题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; }

考题 多选题现有:   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); }