using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//静态类用static标记
//静态类的成员必须都是静态的
//静态类是密封的,不可继承
namespace StaticClass
{
public static class MyMath
{
public static float PI = 3.14f;
public static bool IsOdd(int x)
{
return x % 2 == 1;
}
public static int Times2(int x)
{
return 2*x;
}
}
class Program
{
static void Main(string[] args)
{
int val = 3;
Console.WriteLine("{0} is Odd is {1}.",val,MyMath.IsOdd(val));
Console.WriteLine("{0}* 2={1}.", val, MyMath.Times2(val));
}
}
}