package tickect; class ticketnum implements Runnable { public int tickets = 100; String str = new String(); public void run() { while(true) { synchronized(str) { if (tickets>0) { System.out.printf("The Thread: %s is selling the %dth ticket!\n"…
package thread_test; class A implements Runnable { public void run() { while(true) { System.out.println("AA"); } } } class B implements Runnable { public void run() { while (true) { System.out.println("BB"); try { Thread.sleep(500); }…
1. Java语言基础 谈到Java语 言基础学习的书籍,大家肯定会推荐Bruce Eckel的<Thinking in Java>.它是一本写的相当深刻的技术书籍,Java语言基础部分基本没有其它任何一本书可以超越它.该书的作者Bruce Eckel在网络上被称为天才的投机者,作者的<Thinking in C++> 在1995年曾获SoftwareDevelopment Jolt Award最佳书籍大奖,<Thinking in Java>被评为1999年Java…