笔试题系列之二

看到昨天post的一道笔试题还比较受大家欢迎,
我准备把这个东西做成一个系列,
难度都不大,
算是对基础知识的一个回顾,
有兴趣的话大家就瞧两眼,
希望看明白之前不要用编译器调试


请指出下面代码的运行结果,并阐述原因

using System;
using System.Collections;
namespace param
{
 class Class1
 {
  [STAThread]
  static void Main(string[] args)
  {
   Hashtable ht = new Hashtable();
   for(int i = 0; i < 5;)
    ht.Add(new cusKey(i++),i);

   if(ht.ContainsKey(new cusKey(3)))
   {
    Console.WriteLine("find!");
   }
   else
   {
    Console.WriteLine("can't find!");
   }
   Console.Read();
  }

  public class cusKey
  {
   int keyNumber;
   public cusKey(int n) { keyNumber = n; }
  }

 }
}



更多笔试题

posted on 2004-09-29 10:31  陈叙远  阅读(3927)  评论(7编辑  收藏  举报

导航