![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java se
wyodyia
这个作者很懒,什么都没留下…
展开
-
ProduceAndConsume
class CharCon{ private char[] data = new char[5]; private int cnt = 0; public synchronized void push(char ch) { while (cnt == data.length) { try { this.wait(); } catch (Exception e) { } } this.notify(); data[cnt] = ch; cnt++; Sy原创 2010-08-11 11:55:00 · 1042 阅读 · 0 评论 -
SaleTicktes
class Ticktes implements Runnable{ private int tick = 250; //String str = new String("hehe"); public void run() { while (true) { synchronized (this)//this表示锁定一个对象 可替换上面定义的 str { if (tick >= 0) { System.out.printf("%s正在卖第%d张票/n", Thread.curr原创 2010-08-09 15:14:00 · 802 阅读 · 0 评论 -
约瑟夫
package com.fenzi;public class yueshefu { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub LinkTable lb = new LinkTable(2,3); lb.createTable(); lb.printTable(); lb.play(); }}class Node{ public int i; N原创 2010-08-29 17:54:00 · 766 阅读 · 0 评论