深圳深云村房价:这是什么??

来源:百度文库 编辑:神马品牌网 时间:2024/05/09 13:45:50
class TestSingleton
{
private static TestSingleton instance=new TestSingleton();

private TestSingleton()
{
System.out.println("only one instance.");
}

public static TestSingleton getInstance()
{
return instance;
}

}
class Main
{

public static void main(String[]args)
{
TestSingleton.getInstance();
TestSingleton.getInstance();
//new TestSingleton();
}
}
它的功能??

这是一个测试例子的程序。它测试关于共有类和私有类的访问。