首页 试题详情
单选题

在C#中,观察下列代码,找出错误的行,并修改正确的选项是() ArrayList list = new ArrayList() { }; Customer teng = new Customer(" 马腾 ", 32, " 汕头市 "); Customer yun = new Customer(" 王云 ", 28, " 杭州市 "); Customer si= new Customer(" 李军 ", 25, " 仙桃市 "); list.Add(teng); list.Add(yun); list.Add(si); Console.WriteLine(" 排队等待的客户有:"); for (int i = 0; i < list.Length; i++)//(1) { Console.WriteLine("{0} 号:{1}", i+1, (list[i] as Customer).Name); }

A没有错

B注释(1)处的List.Length改成List.Count

C注释(1)处的List.Length改成List.Count()

D注释(1)处的List.Length改成List.Length()

正确答案:A (备注:此答案有误)

相似试题

  • 单选题

    C#观察下列代码找出错误修改正确选项是() ArrayList list = new ArrayList() { }; Customer teng = new Customer(" 马腾 ", 32, " 汕头市 "); Customer yun = new Customer(" 王云 ", 28, " 杭州市 "); Customer si= new Customer(" 李军 ", 25, " 仙桃市 "); list.Add(teng); list.Add(yun); list.Add(si); Console.WriteLine(" 排队等待客户有:"); for (int

    答案解析

  • 单选题

    C#下列描述错误是()

    答案解析

  • 单选题

    C#下列代码报错原因是( ) public interface IAnimal { //Eat()方法报错 public void Eat(); }

    答案解析

  • 单选题

    C#观察下列代码,给出对应结果(): ArrayList list = new ArrayList() { }; Customer teng = new Customer(" 马腾 ", 32, " 汕头市 "); Customer yun = new Customer(" 马云 ", 33, " 汕头市 "); list.Add(teng);list.Add(yun); Console.WriteLine((list[2] as Customer).Name);

    答案解析

热门题库