Java伪静态

package com.sing.text;

public class School {
private static School sc=new School();
private School(){
}
public static School getInstance(){
return sc;
}
}

package com.sing.text;

public class Text {
public static void main(String[] args){
School sc=School.getInstance();
School s1=School.getInstance();
System.out.println(sc==s1);
}
}


Java伪静态
http://example.com/java伪静态.html
作者
John Doe
发布于
2021年5月7日
许可协议