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

题目内容 (请给出正确答案)
单选题
1. interface DoStuff2 {  2. float getRange(int low, int high); }  3.  4. interface DoMore {  5. float getAvg(int a, int b, int c); }  6.  7. abstract class DoAbstract implements DoStuff2, DoMore { }  8.  9. class DoStuff implements DoStuff2 {  10. public float getRange(int x, int y) { return 3.14f; } }  11.  12. interface DoAll extends DoMore {  13. float getAvg(int a, int b, int c, int d); }  What is the result?()
A

 The file will compile without error.

B

 Compilation fails. Only line 7 contains an error.

C

 Compilation fails. Only line 12 contains an error.

D

 Compilation fails. Only line 13 contains an error.

E

 Compilation fails. Only lines 7 and 12 contain errors.

F

 Compilation fails. Only lines 7 and 13 contain errors.

G

 Compilation fails. Lines 7, 12, and 13 contain errors.


参考答案

参考解析
解析: 暂无解析
更多 “单选题1. interface DoStuff2 {  2. float getRange(int low, int high); }  3.  4. interface DoMore {  5. float getAvg(int a, int b, int c); }  6.  7. abstract class DoAbstract implements DoStuff2, DoMore { }  8.  9. class DoStuff implements DoStuff2 {  10. public float getRange(int x, int y) { return 3.14f; } }  11.  12. interface DoAll extends DoMore {  13. float getAvg(int a, int b, int c, int d); }  What is the result?()A  The file will compile without error.B  Compilation fails. Only line 7 contains an error.C  Compilation fails. Only line 12 contains an error.D  Compilation fails. Only line 13 contains an error.E  Compilation fails. Only lines 7 and 12 contain errors.F  Compilation fails. Only lines 7 and 13 contain errors.G  Compilation fails. Lines 7, 12, and 13 contain errors.” 相关考题
考题 给出下面的接口: interface A{ int method1(int i); int method2(int j); } 下面那个类实现了这个接口,并且不是抽象的?() A.class B implements A{ int method1(){} int method2(){} }B.class B { int method1(int i){} int method2(int j){} }C.class B implements A{ int method1(int i){} int method2(int j){} }D.class B extends A{ int method1(int i){} int method2(int j){} }

考题 interface A{int x = 0;}class B{int x =1;}class C extends B implements A {public void pX(){System.out.println(x);}public static void main(String[] args) {new C().pX();}}

考题 有一个接口定义如下,下列选项中实现了该接口并且不是抽象的是( )。interface A{ int method1 (int i); int method2 (int j);}A.class B implements A{ int method1() { } int method2() { }}B.class B{int method1(int i) { }int method2(int j) { }}C.class B implements A{ int methodl(int i) { } int method2(intj) { }}D.class B extends A{int method1(int i) { }int method2(int j) { }}

考题 有一个接口定义如下,下列选项中实现了该接口并且不是抽象的是 interface A { int method1(int i); int method2(int j); }A.class B implements A { int method 1(){} int method 2(){} }B.class B { int method 1(int i){} int method 2(int j){} }C.class B implements A { int method 1(int i){} int method 2(int j){} }D.class B extends A { int method 2(int j){} int method 1(int j){} }

考题 有一个接口定义如下,下列选项中实现了该接口并且不是抽象的是( )。A.interface A { int methodl(int i); int method2(int j); } classBimplementsAB.classB { {C.class B implements AD.class B extends A { {

考题 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. interface DoStuff2 {  2. float getRange(int low, int high); }  3.  4. interface DoMore {  5. float getAvg(int a, int b, int c); }  6.  7. abstract class DoAbstract implements DoStuff2, DoMore { }  8.  9. class DoStuff implements DoStuff2 {  10. public float getRange(int x, int y) { return 3.14f; } }  11.  12. interface DoAll extends DoMore {  13. float getAvg(int a, int b, int c, int d); }  What is the result?() A、 The file will compile without error.B、 Compilation fails. Only line 7 contains an error.C、 Compilation fails. Only line 12 contains an error.D、 Compilation fails. Only line 13 contains an error.E、 Compilation fails. Only lines 7 and 12 contain errors.F、 Compilation fails. Only lines 7 and 13 contain errors.G、 Compilation fails. Lines 7, 12, and 13 contain errors.

考题 interface DeclareStuff{  public static final int EASY = 3;  void doStuff(int t); }  public class TestDeclare implements DeclareStuff {  public static void main(String [] args) {  int x=5;  new TestDeclare().doStuff(++x);  }  void doStuff(int s) {  s += EASY + ++s;  System.out.println(”s “ + s);  }  }  What is the result?() A、 s 14B、 s 16C、 s 10D、 Compilation fails.E、 An exception is thrown at runtime.

考题 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()?A、 private void set Var(int a, float c, int b) {}B、 protected void set Var(int a, int b, float c) {}C、 public int set Var(int a, float c, int b) {return a:}D、 public int set Var(int a, int b, float c) {return a:}E、 protected float set Var(int a, int b, float c) {return c:}

考题 Given the following interface definition, which definitions are valid?()   interface I {   void setValue(int val);   int getValue();   }    DEFINITION a:   (a) class a extends I {  int value;   void setValue(int val) { value = val;  }   int getValue() {  return value;  }   }   DEFINITION b:   (b) interface b extends I {   void increment();   }   DEFINITION c:   (c) abstract class c implements I {   int getValue() {  return 0;  }  abstract void increment();   }   DEFINITION d:   (d) interface d implements I {  void increment();  }   DEFINITION e:   (e) class e implements I {  int value;   public void setValue(int val) { value = val; }  }  A、Definition a.B、Definition b.C、Definition c.D、Definition d.E、Definition e.

考题 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. interface Animal {  2. void eat();  3. }  4.  5. // insert code here  6.  7. public class HouseCat extends Feline {  8. public void eat() { }  9. }   和五个声明:  abstract class Feline implements Animal { }  abstract class Feline implements Animal { void eat(); }  abstract class Feline implements Animal { public void eat(); }  abstract class Feline implements Animal { public void eat() { } }  abstract class Feline implements Animal { abstract public void eat(); }  分别插入到第5行,有几个可以通过编译?() 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.

考题 public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()A、 public class Circle implements Shape { private int radius; }B、 public abstract class Circle extends Shape { private int radius; }C、 public class Circle extends Shape { private int radius; public void draw(); }D、 public abstract class Circle implements Shape { private int radius; public void draw(); }E、 public class Circle extends Shape { private int radius;public void draw() {/* code here */} }F、 public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

考题 现有:   1. interface Altitude {   2.   //insert code here  3. }    和4个声明:  int HIGH = 7;   public int HIGH = 7;   abstract int HIGH = 7;   interface int HIGH = 7;    分别插入到第2行,有多少行可以编译?()  A、 0B、 1C、 2D、 3E、 4

考题 多选题public class MethodOver  {  public void setVar (int a, int b, float c)  {  }  }   Which two overload the setVar method?()APrivate void setVar (int a, float c, int b)  { }BProtected void setVar (int a, int b, float c) { }CPublic int setVar (int a, float c, int b) (return a;)DPublic int setVar (int a, int b, float c) (return a;)EProtected float setVar (int a, int b, float c) (return c;)

考题 多选题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 interface definition, which definitions are valid?()   interface I {   void setValue(int val);   int getValue();   }    DEFINITION a:   (a) class a extends I {  int value;   void setValue(int val) { value = val;  }   int getValue() {  return value;  }   }   DEFINITION b:   (b) interface b extends I {   void increment();   }   DEFINITION c:   (c) abstract class c implements I {   int getValue() {  return 0;  }  abstract void increment();   }   DEFINITION d:   (d) interface d implements I {  void increment();  }   DEFINITION e:   (e) class e implements I {  int value;   public void setValue(int val) { value = val; }  }ADefinition a.BDefinition b.CDefinition c.DDefinition d.EDefinition e.

考题 单选题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. interface Altitude {   2.   //insert code here  3. }    和4个声明:  int HIGH = 7;   public int HIGH = 7;   abstract int HIGH = 7;   interface int HIGH = 7;    分别插入到第2行,有多少行可以编译?()A  0B  1C  2D  3E  4

考题 单选题现有:  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. interface Animal {  2. void eat();  3. }  4.  5. // insert code here  6.  7. public class HouseCat extends Feline {  8. public void eat() { }  9. }   和五个声明:  abstract class Feline implements Animal { }  abstract class Feline implements Animal { void eat(); }  abstract class Feline implements Animal { public void eat(); }  abstract class Feline implements Animal { public void eat() { } }  abstract class Feline implements Animal { abstract public void eat(); }  分别插入到第5行,有几个可以通过编译?()A 0B 1C 2D 3

考题 多选题public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()Apublic class Circle implements Shape { private int radius; }Bpublic abstract class Circle extends Shape { private int radius; }Cpublic class Circle extends Shape { private int radius; public void draw(); }Dpublic abstract class Circle implements Shape { private int radius; public void draw(); }Epublic class Circle extends Shape { private int radius;public void draw() {/* code here */} }Fpublic abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

考题 多选题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 A {  2. public int getNumber(int a) {  3.     return a + 1;  4. }  5. }  6.    7. class B extends A {  8. public int getNumber (int a) {  9. return a + 2  10. }  11.    12. public static void main (String args[])  {  13. A a = new B();  14. System.out.printIn(a.getNumber(0));  15.    } 16. }     What is the result?()A  Compilation succeeds and 1 is printed.B  Compilation succeeds and 2 is printed.C  An error at line 8 causes compilation to fail.D  An error at line 13 causes compilation to fail.E  An error at line 14 causes compilation to fail.

考题 单选题1. interface foo {  2. int k = 0;  3. } 4.    5. public class test implements Foo (  6. public static void main(String args[]) (  7. int i;  8. Test test = new test ();  9. i= test.k;  10.i= Test.k;  11.i= Foo.k;  12.)  13.)  14.        What is the result?()A  Compilation succeeds.B  An error at line 2 causes compilation to fail.C  An error at line 9 causes compilation to fail.D  An error at line 10 causes compilation to fail.E  An error at line 11 causes compilation to fail.