public class Me
{
int x=1;
static int y=2;
public static void method()//静态方法
{
System.out.println("实例变量x = " + new Test().x);//在静态方法中访问类的实例变量需首先进行类的实例化
System.out.println("静态变量y = " + y);//在静态方法中可直接访问类的静态变量
}
public static void main(String[] args)
{
Test.method();
Test t = new Test();
System.out.println("x = " + t.x);
}
}