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

2011年JAVA认证模拟题(35)

 Q103 If you ran the following program, what lines would be included in its output?   class Question {
  public static void main (String[] args)
  {
  int i,j;
  for(i=0, j=0; i+j < 20; ++i, j += i--)
  {
  System.out.println(i+j);
  }
  }
  }
  A 5
  B 8
  C 13
  D The program cannot be compiled because the for statement’s syntax is incorrect.
  Q104 What is the value of 9 + 8 % 7 + 6?
  A 17
  B 16
  C 13
  D 4
  Q105 At 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.add(“This”);
  7. v1.add(v2);
  8. String s = (String) v1.elementAt(0);
  9. v1 = v2;
  10. v2 = v1;
  11. v1.add(s);
  12. }
  13.}
  A line 5
  B line 6
  C line 8
  D line 9
  Q103 ABC
  Q104 B
  Q105 D
页: [1]
查看完整版本: 2011年JAVA认证模拟题(35)