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

2011年JAVA认证模拟题(39)

 Q115 How many bytes does the following program write to temp.txt?   import java.io.*;
  public class TestIOApp {
  public static void main(String args[])
  throws IOException {
  FileOutputStream outStream = new
  FileOutputStream(“test.txt”);
  String s = “test”;
  for (int i=0; i
  outStream.write(s.charAt(i));
  outStream.close();
  }
  }
  A 2 bytes
  B 4 bytes
  C 8 bytes
  D 16 bytes
  Q116 What is the output of the following program?
  import java.util.*;
  class Question {
  public static void main (String args[])
  {
  TreeMap map = new TreeMap();
  map.put(“one”, “1”);
  map.put(“two”, “2”);
  map.put(“three”, “3”);
  displayMap(map);
  }
  static void displayMap(TreeMap map) {
  Collection c = map.entrySet();
  Iterator i = c.iterator();
  while(i.hasNext()) {
  Object o = i.next();
  System.out.print(o.toString());
  }
  }
  }
  A onetwothree
  B 123
  C one=1three=3two=2

  D onethreetwo

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

2011年JAVA认证模拟题(39)

</p>  Q117 Which lines of output are displayed by the following program?
  class Question {
  public static void main(String [] args)
  {

  for(int i=0; i
页: [1]
查看完整版本: 2011年JAVA认证模拟题(39)