声明是在一个块中引入变量
每个变量有一个标识符和一个类型
每个变量的类型不能被改变
using System;
public sealed class Hiker
{
public static void Main()
{
int result;
result = 9 * 6;
int thirteen;
thirteen = 13;
Console.Write(result / thirteen);
Console.Write(result % thirteen);
}
}
这样声明一个变量是非法的:这个变量可能不会被用到。例如:
if (...)
int x = 42; //编译时出错
else……
转载于:https://blog.51cto.com/5257890/904405