单选题} 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 14 causes compilation to fail.

题目

单选题} 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 14 causes compilation to fail.

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

1. class A {  2. public byte getNumber ()  {  3.   return 1;  4.   }  5. }  6.    7. class B extends A {  8. public short getNumber()  {  9.  return 2;  10. }  11.    12. public static void main (String args[]) {   13.    B  b = new B ();  14.      System.out.printIn(b.getNumber())     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 14 causes compilation to fail.
  • E、 Compilation succeeds but an exception is thrown at line 14.

正确答案:C

第2题:

class A {   public byte getNumber () {   return 1;   }   }   class B extends A {   public short getNumber() {   return 2;   }    public static void main (String args) {   B b = new B ();    System.out.printIn(b.getNumber())  }   }   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 14 causes compilation to fail.
  • E、 Compilation succeeds but an exception is thrown at line 14.

正确答案:C

第3题:

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.

正确答案:B

第4题:

1. class A {  3. public String to String() {  4. return “4”;  5. }  6. }  7. class B extends A {  8. public String toString() { 9. return super.toString() + “3”;  10. }  11. }  12. public class Test {  13. public static void main (String[] args) {  14. System.out.printIn(new B()); 15. }  16. }   What is the result( )?  

  • A、 Compilation succeeds and 4 is printed.
  • B、 Compilation …………… is printed.
  • C、 An error on line 9 cause compilation to fail.
  • D、 An error on line 14 cause compilation to fail.
  • E、 Compilation succeeds but an exception is thrown at line 9.

正确答案:B

第5题:

1. class A {  2. public String toString ()  {  3. return “4”;  4. }  5. }  6. class B extends A {  7. public String toString ()   {  8. return super.toString()  + “3”;  9. }  10. }  11. public class Test {  12.   public static void main(String[]args)  {  13.      System.out.printIn(new B());  14.      }  15. }    What is the result?()  

  • A、 Compilation succeeds and 4 is printed.
  • B、 Compilation succeeds and 43 is printed.
  • C、 An error on line 9 causes compilation to fail.
  • D、 An error on line 14 causes compilation to fail.
  • E、 Compilation succeeds but an exception is thrown at line 9.

正确答案:B

第6题:

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.

正确答案:C

第7题:

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.

正确答案:B

第8题:

class A {   public String toString () {   return “4”;   }   }   class B extends A {   8. public String toString () {   return super.toString() + “3”;   }   }   public class Test {   public static void main(Stringargs) {   System.out.printIn(new B());   }   }   What is the result?()  

  • A、 Compilation succeeds and 4 is printed.
  • B、 Compilation succeeds and 43 is printed.
  • C、 An error on line 9 causes compilation to fail.
  • D、 An error on line 14 causes compilation to fail.
  • E、 Compilation succeeds but an exception is thrown at line 9.

正确答案:B

第9题:

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.

正确答案:A

第10题:

1. class A {  2. public byte file Number ( ) { 3. return l;  4. }  5. }  6.  7. Class B extends A {  8. public short getNumber( ) {  9.  return 2;  10. }  11.  12. public short getNumber( ) {  13. B b = new B( );  14. System.out.printIn(b.getNumber( ));  15. }  16. }   What is the result()?  

  • A、 Compilation succeeds and l is printed.
  • B、 Compilation succeeds and 2 printed.
  • C、 An error at line 8 cause compilation to fail.
  • D、 An error at line 14 cause complication to fail.
  • E、 Complication succeeds but an exception is thrown at line 14.

正确答案:C

更多相关问题