身体健康 翻译:这是什么??

来源:百度文库 编辑:高校问答 时间:2024/05/12 10:06:19
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();
}
}
它的功能??

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