笔试题系列之四
请指出下面代码的运行结果并解释原理,
老规矩,不许用编译器
using System;
namespace param
{
class Class1
{
static int i = getNum();
int j = getNum();
static int num = 1;
static int getNum()
{
return num;
}
[STAThread]
static void Main(string[] args)
{
Console.WriteLine(string.Format("i={0}",i));
Console.WriteLine(string.Format("j={0}",new Class1().j));
Console.Read();
}
}
}
更多笔试题
老规矩,不许用编译器
using System;
namespace param
{
class Class1
{
static int i = getNum();
int j = getNum();
static int num = 1;
static int getNum()
{
return num;
}
[STAThread]
static void Main(string[] args)
{
Console.WriteLine(string.Format("i={0}",i));
Console.WriteLine(string.Format("j={0}",new Class1().j));
Console.Read();
}
}
}
更多笔试题