Java认证考试

11. static class A {  12. void process() throws Exception { throw new Exception(); }  13. }  14. static class B extends A {  15. void process() { System.out.println(”B”); }  16. }  17. public static void main(String[] args) {  18. new B().process();  19.

题目

11. static class A {  12. void process() throws Exception { throw new Exception(); }  13. }  14. static class B extends A {  15. void process() { System.out.println(”B”); }  16. }  17. public static void main(String[] args) {  18. new B().process();  19. }  What is the result?() 

  • A、 B
  • B、 The code runs with no output.
  • C、 Compilation fails because of an error in line 12.
  • D、 Compilation fails because of an error in line 15.
  • E、 Compilation fails because of an error in line 18.
参考答案和解析
正确答案:A
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Which two code fragments correctly create and initialize a static array of int elements()

  • A、static final int[]a={100,200};
  • B、static final int[]a;static{a=new int[2];a[0]=100;a[1]=200;}
  • C、static final int[]a=new int[2]{100,200};
  • D、static final int[]a;static void int(){a=new int[3];a[0]=100;a[1]=200;}

正确答案:A,B

第2题:

Which statements about static inner classes are true?()

  • A、 A static inner class requires a static initializer.
  • B、 A static inner class requires an instance of the enclosing class.
  • C、 A static inner class has no reference to an instance of the enclosing class.
  • D、 A static inner class has access to the non-static members of the outer class.
  • E、 Static members of a static inner class can be referenced using the class name of the static inner  class.

正确答案:C,E

第3题:

Which two code fragments correctly create and initialize a static array of int elements()

A.static final int[]a={100,200};

B.static final int[]a;static{a=new int[2];a[0]=100;a[1]=200;}

C.static final int[]a=new int[2]{100,200};

D.static final int[]a;static void int(){a=new int[3];a[0]=100;a[1]=200;}


参考答案:A, B

第4题:

单选题
11. public static void append(List list) { list.add(”0042”); }  12. public static void main(String[] args) {  13. List intList = new ArrayList();  14. append(intList);  15. System.out.println(intList.get(0));  16. }  What is the result?()
A

 42

B

 0042

C

 An exception is thrown at runtime.

D

 Compilation fails because of an error in line 13.

E

 Compilation fails because of an error in line 14.


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

第5题:

11. public static void append(List list) { list.add(”0042”); }  12. public static void main(String[] args) {  13. List intList = new ArrayList();  14. append(intList);  15. System.out.println(intList.get(0));  16. }  What is the result?() 

  • A、 42
  • B、 0042
  • C、 An exception is thrown at runtime.
  • D、 Compilation fails because of an error in line 13.
  • E、 Compilation fails because of an error in line 14.

正确答案:B

第6题:

在C#程序中.入口函数的正确声明为:()

  • A、static int main(){……}
  • B、static void main(){……}
  • C、static void Main(){……}
  • D、static main(){……}

正确答案:C

第7题:

Given an EL function declared with:11.  12.spin 13.com.example.Spinner 14. 15.java.lang.String spinIt() 16. 17. Which two are true?()

  • A、The function method must have the signature: public String spin().
  • B、The method must be mapped to the logical name "spin" in the web.xml file.
  • C、The function method must have the signature: public String spinIt().
  • D、The function method must have the signature public static String spin().
  • E、The function method must have the signature: public static String spinIt().
  • F、The function class must be named Spinner, and must be in the package com.example.

正确答案:E,F

第8题:

11. public class Counter {  12. public static void main(String[] args) {  13. int numArgs = /* insert code here */;  14. }  15. }  and the command line: java Counter one fred 42 Which code, inserted at line 13, captures the number of arguments passed into the program?() 

  • A、 args.count
  • B、 args.length
  • C、 args.count()
  • D、 args.length()
  • E、 args.getLength()

正确答案:B

第9题:

Given:   11. static class A {   12. void process() throws Exception { throw new Exception(); }   13. }   14. static class B extends A {   15. void process() { System.out.println("B "); }   16. }   17. public static void main(String[] args) {   18. A a = new B();   19. a.process();   20. }   What is the result? ()

  • A、 Compilation fails because of an error in line 19.
  • B、 An exception is thrown at runtime.
  • C、 B
  • D、 Compilation fails because of an error in line 18.
  • E、 Compilation fails because of an error in line 15. 
  • F、 The code runs with no output.

正确答案:A

第10题:

单选题
11. public class Counter {  12. public static void main(String[] args) {  13. int numArgs = /* insert code here */;  14. }  15. }  and the command line: java Counter one fred 42 Which code, inserted at line 13, captures the number of arguments passed into the program?()
A

 args.count

B

 args.length

C

 args.count()

D

 args.length()

E

 args.getLength()


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

更多相关问题