摘要:
/** * 文件名: Customer.java * * 顾客 * **/public class Customer{ @SuppressWarnings("unused") private Shop shop = null; private String name = null; public void buy(){ int count = shop.getBreadCount(); if(count > 0){ shop.setBreadCount(--count); System.out.println(name +" says : I bought 阅读全文
摘要:
package com.cfd.thread;/** * 死锁 * @author cfd * */class DLockThread extends Thread{ static Object a = new Object(); static Object b = new Object(); String firstObj = ""; public DLockThread(String firstObj, String threadName){ this.firstObj = firstObj; super.setName(threadName); } public vo 阅读全文