//建立一個非公平鎖,默認是非公平鎖 Lock nonFairLock= new ReentrantLock(); Lock nonFairLock= new ReentrantLock(false); //建立一個公平鎖,構造傳參true Lock fairLock= new ReentrantLock(true);