单选题abstract class abstrctIt {  abstract float getFloat ();  } public class AbstractTest extends AbstractIt { private float f1= 1.0f;  private float getFloat () {return f1;}  }   What is the result?()A Compilation is successful.B An error on line 6 causes a runtime failure.C An error at line 6 causes compilation to fail.D An error at line 2 causes compilation to fail.

单选题
abstract class abstrctIt {  abstract float getFloat ();  } public class AbstractTest extends AbstractIt { private float f1= 1.0f;  private float getFloat () {return f1;}  }   What is the result?()
A

 Compilation is successful.

B

 An error on line 6 causes a runtime failure.

C

 An error at line 6 causes compilation to fail.

D

 An error at line 2 causes compilation to fail.


参考解析

解析: 暂无解析

相关考题:

public class ArrayTest {   public static void main (Stringargs) {   float f1, f2;   f1 = new float [10];  f2 = f1;   System.out.printIn (“f2[0]=” + f2[0]);   }  }   What is the result?()A、 It prints f2[0] = 0.0B、 It prints f2[0] = NaNC、 An error at line 5 causes compile to fail.D、 An error at line 6 causes compile to fail.E、 An error at line 6 causes an exception at runtime.

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. class Super {  2. public float getNum() { return 3.0f; }  3. }  4.   5. public class Sub extends Super {  6.   7. }  Which method, placed at line6, causes compilation to fail?()  A、 public void getNum(){}B、 public void getNum(double d){}C、 public float getNum() { return 4.0f; }D、 public double getNum(float d) { return 4.0d; }

class super {   public float getNum() {return 3.0f;}   }   public class Sub extends Super {   }   Which method, placed at line 6, will cause a compiler error?()A、 Public float getNum() {return 4.0f; }B、 Public void getNum (){}C、 Public void getNum (double d){}D、 Public double getNum (float d) {retrun 4.0f; }

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. abstract class AbstractIt {  2. abstract float getFloat();  3. }  4. public class AbstractTest extends AbstractIt {  5. private float f1 = 1.0f;  6. private float getFloat() { return f1; }  7. }  What is the result?() A、 Compilation succeeds.B、 An exception is thrown.C、 Compilation fails because of an error at line 2.D、 Compilation fails because of an error at line 6.

public class Test {  private static float[] f = new float[2];  public static void main(String args[]) {  System.out.println(“f[0] = “ + f[0]);  }  }   What is the result?()  A、 f[0] = 0B、 f[0] = 0.0C、 Compilation fails.D、 An exception is thrown at runtime.

abstract class abstrctIt {   abstract float getFloat ();   }   public class AbstractTest extends AbstractIt {   private float f1= 1.0f;   private float getFloat () {return f1;}   }   What is the result? ()A、 Compilation is successful.B、 An error on line 6 causes a runtime failure.C、 An error at line 6 causes compilation to fail.D、 An error at line 2 causes compilation to fail.

package foo;  import java.util.Vector; private class MyVector extends Vector {  int i = 1;  public MyVector() {  i = 2; } }  public class MyNewVector extends MyVector {  public MyNewVector() {  i = 4;  }  public static void main(String args[]) {  MyVector v = new MyNewVector();  }  }  What is the result?()A、 Compilation succeeds.B、 Compilation fails because of an error at line 5.C、 Compilation fails because of an error at line 6.D、 Compilation fails because of an error at line 14.E、 Compilation fails because of an error at line 17.

class BaseClass{  private float x= 1.0f;  protected void setVar (float f) {x = f;}  }  class SubClass extends BaseClass   {  private float x = 2.0f;  //insert code here  }   Which two are valid examples of method overriding?()        A、 Void setVar(float f) {x = f;}B、 Public void setVar(int f) {x = f;}C、 Public void setVar(float f) {x = f;}D、 Public double setVar(float f) {x = f;}E、 Public final void setVar(float f) {x = f;}F、 Protected float setVar() {x=3.0f; return 3.0f; }

class BaseClass{   private float x= 1.0f;   protected void setVar (float f) {x = f;}   }   class SubClass exyends BaseClass {   private float x = 2.0f;   //insert code here  8. }   Which two are valid examples of method overriding?()A、 Void setVar(float f) {x = f;}B、 Public void setVar(int f) {x = f;}C、 Public void setVar(float f) {x = f;}D、 Public double setVar(float f) {x = f;}E、 Public final void setVar(float f) {x = f;}F、 Protected float setVar() {x=3.0f; return 3.0f; }

1. class super {  2. public float getNum() {return 3.0f;}  3. }  4.    5. public class Sub extends Super { 6.   7. }   Which method, placed at line 6, will cause a compiler error?()  A、  Public float getNum()   {return 4.0f; }B、  Public void getNum ()  { }C、  Public void getNum (double d)   { }D、  Public double getNum (float d) {retrun 4.0f; }

1. public class ArrayTest {  2. public static void main (String[]args)  {  3. float f1[], f2[];  4. f1 = new float [10];  5. f2 = f1;  6. System.out.printIn (“f2[0]=” + f2[0]);  7.  }  8. }   What is the result?()  A、 It prints f2[0] = 0.0B、 It prints f2[0] = NaNC、 An error at line 5 causes compile to fail.D、 An error at line 6 causes compile to fail.E、 An error at line 6 causes an exception at runtime.

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 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.

单选题public class Test {  private static float[] f = new float[2];  public static void main(String args[]) {  System.out.println(“f[0] = “ + f[0]);  }  }   What is the result?()A f[0] = 0B f[0] = 0.0C Compilation fails.D An exception is thrown at runtime.

单选题abstract class abstrctIt {  abstract float getFloat ();  } public class AbstractTest extends AbstractIt { private float f1= 1.0f;  private float getFloat () {return f1;}  }   What is the result?()A Compilation is successful.B An error on line 6 causes a runtime failure.C An error at line 6 causes compilation to fail.D An error at line 2 causes compilation to fail.

多选题class BaseClass{  private float x= 1.0f;  protected void setVar (float f) {x = f;}  } class SubClass extends BaseClass   {  private float x = 2.0f;  //insert code here 16. }   Which two are valid examples of method overriding?()AVoid setVar(float f) {x = f;}BPublic void setVar(int f) {x = f;}CPublic void setVar(float f) {x = f;}DPublic double setVar(float f) {x = f;}EPublic final void setVar(float f) {x = f;}FProtected float setVar() {x=3.0f; return 3.0f; }

单选题1. abstract class AbstractIt {  2. abstract float getFloat();  3. }  4. public class AbstractTest extends AbstractIt {  5. private float f1 = 1.0f;  6. private float getFloat() { return f1; }  7. }  What is the result?()A Compilation succeeds.B An exception is thrown.C Compilation fails because of an error at line 2.D Compilation fails because of an error at line 6.

单选题class super {   public float getNum() {return 3.0f;}   }   public class Sub extends Super {   }   Which method, placed at line 6, will cause a compiler error?()A Public float getNum() {return 4.0f; }B Public void getNum (){}C Public void getNum (double d){}D Public double getNum (float d) {retrun 4.0f; }

单选题1. public class ArrayTest {  2. public static void main (String[]args)  {  3. float f1[], f2[];  4. f1 = new float [10];  5. f2 = f1;  6. System.out.printIn (“f2[0]=” + f2[0]);  7.  }  8. }   What is the result?()A It prints f2[0] = 0.0B It prints f2[0] = NaNC An error at line 5 causes compile to fail.D An error at line 6 causes compile to fail.E An error at line 6 causes an exception at runtime.

单选题package foo;  import java.util.Vector; private class MyVector extends Vector {  int i = 1;  public MyVector() {  i = 2; } }  public class MyNewVector extends MyVector {  public MyNewVector() {  i = 4;  }  public static void main(String args[]) {  MyVector v = new MyNewVector();  }  }  What is the result?()A Compilation succeeds.B Compilation fails because of an error at line 5.C Compilation fails because of an error at line 6.D Compilation fails because of an error at line 14.E Compilation fails because of an error at line 17.

单选题1. class Super {  2. public float getNum() { return 3.0f; }  3. }  4.   5. public class Sub extends Super {  6.   7. }  Which method, placed at line6, causes compilation to fail?()A public void getNum(){}B public void getNum(double d){}C public float getNum() { return 4.0f; }D public double getNum(float d) { return 4.0d; }

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

多选题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 */ } }

多选题class BaseClass{  private float x= 1.0f;  protected void setVar (float f) {x = f;}  }  class SubClass extends BaseClass   {  private float x = 2.0f;  //insert code here  }   Which two are valid examples of method overriding?()AVoid setVar(float f) {x = f;}BPublic void setVar(int f) {x = f;}CPublic void setVar(float f) {x = f;}DPublic double setVar(float f) {x = f;}EPublic final void setVar(float f) {x = f;}FProtected float setVar() {x=3.0f; return 3.0f; }

单选题public class ArrayTest {   public static void main (Stringargs) {   float f1, f2;   f1 = new float [10];  f2 = f1;   System.out.printIn (“f2[0]=” + f2[0]);   }  }   What is the result?()A It prints f2[0] = 0.0B It prints f2[0] = NaNC An error at line 5 causes compile to fail.D An error at line 6 causes compile to fail.E An error at line 6 causes an exception at runtime.

单选题1. class super {  2. public float getNum() {return 3.0f;}  3. }  4.    5. public class Sub extends Super { 6.   7. }   Which method, placed at line 6, will cause a compiler error?()A  Public float getNum()   {return 4.0f; }B  Public void getNum ()  { }C  Public void getNum (double d)   { }D  Public double getNum (float d) {retrun 4.0f; }