public class TestStatic
{
public static int a = 0;
public int b = 0;
public TestStatic()
{
a++;
b++;
System.out.println("a:" + a +"," + "b:" + b);
}
public void Test(){}
public static void Test1(){}
public static void main(String[] args)
{
TestStatic ts = new TestStatic();
TestStatic tc = new TestStatic();
//非static方法必須生成對象後才能調用
ts.Test();
//而static方法可以不需要生産對象就能調用
Test1();
}
}