}
class MyLock
{
static Object lacka= new Object();
static Object lockb = new Object();
}
class LockDemo
{
public static void main(String[] args)
{
new Thread(new Lock(true)).start();
new Thread(new Lock(flase)).start();
}
}
单例设计模式:懒汉式
class Single
{
private Single(){};
private static Single s= null;
public static Single getInstance()
{
if(s==null)
{
synchronized(Single.class)
{
if(s==null)
{