会计考友 发表于 2012-8-4 12:33:16

2011年JAVA认证模拟题(31)

  Q91 After which line in the following code is the Vector object, created in line 4, first subject to garbage collection?
  1. import java.util.*;
  2. public class Question {
  3. public static void main(String[] args) {
  4. Vector v1 = new Vector();
  5. Vector v2 = new Vector();
  6. v1 = null;
  7. Vector v3 = v1;
  8. v1 = v2;
  9. v1.add(“This”);
  10. v1.add(v2);
  11. String s = (String) v1.elementAt(0);
  12. v1 = v2;
  13. v2 = v1;
  14. v1.add(s);
  15. }
  16.}
  A line 6
  B line 7
  C line 8
  D line 12
  Q92 In order for the public class MyClass to successfully compile, which of the
  following are true?
  A MyClass must have a correctly formed main() method.
  B MyClass must be defined in the file MyClass.java
  C MyClass must be defined in the MyClass package
  D MyClass must be imported.
  Q93 Which of the following are true about the Error and Exception classes?
  A Both classes extend Throwable.
  B The Error class is final, and the Exception class is not.
  C The Exception class is final and the Error class is not.
  D Both classes implement Throwable.
  Q091 A
  Q092 B
  Q093 A
页: [1]
查看完整版本: 2011年JAVA认证模拟题(31)