静态方法中只允许访问静态数据,那么,如何在静态方法中访问类的实例成员(即没有附加static关键字的字段或方法)?
package t2;
class YZ
{
public int a;
{
a=5;
}
}
public class t2 {
public static void YZX()
{
YZ a=new YZ();
System.out.println(a.a);
}
public static void main(String[] args)
{
YZX();
}
}