?? singletontest.java
字號:
/*******************************************************************
<br>Copyright (C), 2004-2006, yeeku.H.Lee
<br>Program Name:SingletonTest
<br>Author:yeeku.H.lee kongyeeku@163.com
<br>Version:1.0
<br>This program is protected by copyright laws.
<br>Date: 2005-10-2
*******************************************************************/
public class SingletonTest
{
int value ;
private static SingletonTest instance;
private SingletonTest()
{
}
public static SingletonTest getInstance()
{
if (instance == null)
{
instance = new SingletonTest();
}
return instance;
}
public int getValue()
{
return value;
}
public void setValue()
{
value = 9;
}
public static void main(String[] args)
{
SingletonTest t1 = getInstance();
System.out.println(t1.getValue());
SingletonTest t2 = getInstance();
t2.setValue();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -