那是不可能的,我刚刚特意写了个小程序 验证下,代码给你参考下,望采纳
class shiiyan
{
public static void main(String[] args)
{
System.out.println(demo.getStr());
new demo();
System.out.println(demo.getStr());
}
}
class demo
{
private static String str = "静态成员变量";
static
{
System.out.println("静态代码块运行");
}
demo()
{
System.out.println("构造函数运行运行");
}
public static String getStr()
{
return str;
}
}
|