试题答案

3773考试网计算机等级考试试题答案正文

[组图]2009年9月全国计算机等级考试二级Java真题试题

来源:fjzsksw.com 2010-4-7 12:26:17

 

   (30)下列程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是
  public class FindKey
Words{
  public static void main(sring[] args){
  sting text=
  “ An array is a data structur that stores a collection of”
  + “values of the same type . You access each individual value”
  + “through an integer index . For example,if a is an array”
  + “of inergers, then a[i] is the ith integer in the array.”;
  Int arrayCount =0;
  Int idex = -1;
  Sting arrarStr =”array”;
  Index = text.indexof(arrayStr);
  While(index           0) {
  ++arrayCount;
  Index += arrayStr.length();
  Index = text.indexof(arrayStr,index);
  }
  System.out.println
  (“the text contains” + arrayCount + “arrays”);
  }
  }
  A)<
  B)=
  C)<=
  D)>=

  (31)构造方法名必须与______相同,它没有返回值,用户不能直接调用它,只能通过new调用。
  A)类名
  B)对象名
  C)包名
  D)变量名

  (32)在多线程并发程序设计中,能够给对象x加锁的语句是
  A)x.wait( )
  B)synchronized(x)
  C)x.notify( )
  D)x.synchronized( )

 

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

触屏版 电脑版
3773考试网 琼ICP备12003406号-1