PDF 课件和源代码下载地址:
https://github.com/geektime-geekbang/LetsJava
作者回复:
对。Zulu貌似没有这个工具,所以深入学习这些工具之前建议结合自己公司使用的JDK版本。
作者回复:
下面是Thread里start方法的注释。
注意到“The result is that two threads are running concurrently”
所以start方法返回之后,线程是保证已经启动运行了的。
所以调用start方法,返回之后就可以调用join了。sleep1ms只是一个程序员的多疑。
/**
* Causes this thread to begin execution; the Java Virtual Machine
* calls the <code>run</code> method of this thread.
* <p>
* The result is that two threads are running concurrently: the
* current thread (which returns from the call to the
* <code>start</code> method) and the other thread (which executes its
* <code>run</code> method).
* <p>
* It is never legal to start a thread more than once.
* In particular, a thread may not be restarted once it has completed
* execution.
*
* @exception IllegalThreadStateException if the thread was already
* started.
* @see #run()
* @see #stop()
*/
public synchronized void start() {