单选题1.public classA{ 2.public String doit(intx,inty){ 3.return"a"; 4.} 5. 6.public String doit(int...vals){ 7.return"b"; 8.} 9.} And: 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

题目
单选题
1.public classA{ 2.public String doit(intx,inty){ 3.return"a"; 4.} 5. 6.public String doit(int...vals){ 7.return"b"; 8.} 9.} And: 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.


相似考题
参考答案和解析
正确答案: C
解析: 暂无解析
更多“单选题1.public classA{ 2.public String doit(intx,inty){ 3.return"a"; 4.} 5. 6.public String doit(int...vals){ 7.return"b"; 8.} 9.} And: 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”相关问题
  • 第1题:

    1.public classA{ 2.public String doit(intx,inty){ 3.return"a"; 4.} 5. 6.public String doit(int...vals){ 7.return"b"; 8.} 9.} And: 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.

    正确答案:A

  • 第2题:

    1. public class X {  2. public static void main (String[]args)   {  3. int [] a = new int [1]  4. modify(a);  5. System.out.printIn(a[0]);  6. }  7.    8. public static void modify (int[] a)  {  9.   a[0] ++;  10.    } 11. }       What is the result?()

    • A、 The program runs and prints “0”
    • B、 The program runs and prints “1”
    • C、 The program runs but aborts with an exception.
    • D、 An error “possible undefined variable” at line 4 causes compilation to fail.
    • E、 An error “possible undefined variable” at line 9 causes compilation to fail.

    正确答案:B

  • 第3题:

    public class X {   public static void main (Stringargs) {   String s1 = new String (“true”);   Boolean b1 = new Boolean (true);   if (s2.equals(b1)) {   System.out.printIn(“Equal”);   }   }   }   What is the result? () 

    • A、 The program runs and prints nothing.
    • B、 The program runs and prints “Equal”
    • C、 An error at line 5 causes compilation to fail.
    • D、 The program runs but aborts with an exception.

    正确答案:A

  • 第4题:

     public class Test {  public static void replaceJ(string text)  {  text.replace (‘j’, ‘l’);  }  public static void main(String args[])  {  string text = new String (“java”)  replaceJ(text);  system.out.printIn(text);  }  }      What is the result?()  

    • A、 The program prints “lava”
    • B、 The program prints “java”
    • C、 An error at line 7 causes compilation to fail.
    • D、 Compilation succeeds but the program throws an exception.

    正确答案:B

  • 第5题:

    1. public class A {  2.  3. private int counter = 0;  4.  5. public static int getInstanceCount() {  6. return counter;  7. }  8.  9. public A() {  10. counter++;  11. }  12.  13. }  Given this code from Class B:  25.A a1 =new A();  26. A a2 =new A();  27. A a3 =new A();  28. System.out.printIn(A.getInstanceCount() ); What is the result?() 

    • A、 Compilation of class A fails.
    • B、 Line 28 prints the value 3 to System.out.
    • C、 Line 28 prints the value 1 to System.out.
    • D、 A runtime error occurs when line 25 executes.
    • E、 Compilation fails because of an error on line 28.

    正确答案:A

  • 第6题:

    单选题
    1. public class X {  2. public static void main (String[]args)   {  3. int [] a = new int [1]  4. modify(a);  5. System.out.printIn(a[0]);  6. }  7.    8. public static void modify (int[] a)  {  9.   a[0] ++;  10.    } 11. }       What is the result?()
    A

     The program runs and prints “0”

    B

     The program runs and prints “1”

    C

     The program runs but aborts with an exception.

    D

     An error “possible undefined variable” at line 4 causes compilation to fail.

    E

     An error “possible undefined variable” at line 9 causes compilation to fail.


    正确答案: D
    解析: 暂无解析

  • 第7题:

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


    正确答案: C
    解析: 暂无解析

  • 第8题:

    单选题
    public class X {  public static void main (String[]args)  {  String s1 = new String (“true”);  Boolean b1 = new Boolean (true);  if (s2.equals(b1))   {  System.out.printIn(“Equal”);  }  }  }      What is the result?()
    A

     The program runs and prints nothing.

    B

     The program runs and prints “Equal”

    C

     An error at line 5 causes compilation to fail.

    D

     The program runs but aborts with an exception.


    正确答案: D
    解析: 暂无解析

  • 第9题:

    单选题
    Click the Exhibit button. Given this code from Class B: 25.A a1 = new A(); 26.A a2 = new A(); 27.A a3 = new A(); 28.System.out.println(A.getInstanceCount()); What is the result?()
    A

    Compilation of class A fails.

    B

    Line 28 prints the value 3 to System.out.

    C

    Line 28 prints the value 1 to System.out.

    D

    A runtime error occurs when line 25 executes.

    E

    Compilation fails because of an error on line 28.


    正确答案: D
    解析: 暂无解析

  • 第10题:

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

    B

     It prints f2[0] = NaN

    C

     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.


    正确答案: A
    解析: 暂无解析

  • 第11题:

    单选题
    1. interface TestA { String toString(); }  2. public class Test {  3. public static void main(String[] args) {  4. System.out.println(new TestA() {  5. public String toString() { return “test”; }  6. }  7. }  8. }  What is the result?()
    A

     test

    B

     null

    C

     An exception is thrown at runtime.

    D

     Compilation fails because of an error in line 1.

    E

     Compilation fails because of an error in line 4.

    F

     Compilation fails because of an error in line 5.


    正确答案: A
    解析: 暂无解析

  • 第12题:

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


    正确答案: D
    解析: 暂无解析

  • 第13题:

    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.

    正确答案:C

  • 第14题:

    1. public class ForBar  {  2. public static void main(String []args)   {  3.   int i = 0, j = 5;  4. tp: for (;;)  {  5. i ++;  6. for(;;)  7. if(i > --j) break tp;  8. }  9. system.out.printIn(“i = ” + i + “, j = “+ j);  10. }  11. }   What is the result?()  

    • A、 The program runs and prints “i=1, j=0”
    • B、 The program runs and prints “i=1, j=4”
    • C、 The program runs and prints “i=3, j=4”
    • D、 The program runs and prints “i=3, j=0”
    • E、 An error at line 4 causes compilation to fail.
    • F、 An error at line 7 causes compilation to fail.

    正确答案:A

  • 第15题:

    public class X {  public static void main (String[]args)  {  String s1 = new String (“true”);  Boolean b1 = new Boolean (true);  if (s2.equals(b1))   {  System.out.printIn(“Equal”);  }  }  }      What is the result?()  

    • A、 The program runs and prints nothing.
    • B、 The program runs and prints “Equal”
    • C、 An error at line 5 causes compilation to fail.
    • D、 The program runs but aborts with an exception.

    正确答案:A

  • 第16题:

    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.0
    • B、 It prints f2[0] = NaN
    • C、 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.

    正确答案:A

  • 第17题:

    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.

    正确答案:A

  • 第18题:

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


    正确答案: A
    解析: 暂无解析

  • 第19题:

    单选题
    public class X {   public static void main (Stringargs) {   String s1 = new String (“true”);   Boolean b1 = new Boolean (true);   if (s2.equals(b1)) {   System.out.printIn(“Equal”);   }   }   }   What is the result? ()
    A

     The program runs and prints nothing.

    B

     The program runs and prints “Equal”

    C

     An error at line 5 causes compilation to fail.

    D

     The program runs but aborts with an exception.


    正确答案: D
    解析: 暂无解析

  • 第20题:

    单选题
    1.public classA{ 2.public String doit(intx,inty){ 3.return"a"; 4.} 5. 6.public String doit(int...vals){ 7.return"b"; 8.} 9.} And: 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.


    正确答案: C
    解析: 暂无解析

  • 第21题:

    单选题
    1. public class ForBar  {  2. public static void main(String []args)   {  3.   int i = 0, j = 5;  4. tp: for (;;)  {  5. i ++;  6. for(;;)  7. if(i > --j) break tp;  8. }  9. system.out.printIn(“i = ” + i + “, j = “+ j);  10. }  11. }   What is the result?()
    A

     The program runs and prints “i=1, j=0”

    B

     The program runs and prints “i=1, j=4”

    C

     The program runs and prints “i=3, j=4”

    D

     The program runs and prints “i=3, j=0”

    E

     An error at line 4 causes compilation to fail.

    F

     An error at line 7 causes compilation to fail.


    正确答案: D
    解析: 暂无解析

  • 第22题:

    单选题
    Click the Exhibit button. 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.


    正确答案: C
    解析: 暂无解析

  • 第23题:

    单选题
    1. public class A {  2.  3. private int counter = 0;  4.  5. public static int getInstanceCount() {  6. return counter;  7. }  8.  9. public A() {  10. counter++;  11. }  12.  13. }  Given this code from Class B:  25.A a1 =new A();  26. A a2 =new A();  27. A a3 =new A();  28. System.out.printIn(A.getInstanceCount() ); What is the result?()
    A

     Compilation of class A fails.

    B

     Line 28 prints the value 3 to System.out.

    C

     Line 28 prints the value 1 to System.out.

    D

     A runtime error occurs when line 25 executes.

    E

     Compilation fails because of an error on line 28.


    正确答案: E
    解析: 暂无解析

  • 第24题:

    单选题
    public class Test {  public static void replaceJ(string text)  {  text.replace (‘j’, ‘l’);  }  public static void main(String args[])  {  string text = new String (“java”)  replaceJ(text);  system.out.printIn(text);  }  }      What is the result?()
    A

     The program prints “lava”

    B

     The program prints “java”

    C

     An error at line 7 causes compilation to fail.

    D

     Compilation succeeds but the program throws an exception.


    正确答案: A
    解析: 暂无解析