Hi, I got it from
http://www.danchisholm.net/july21/topic/section7/threads2.html class A extends
Thread {
public void run() {
synchronized (this) {
try {wait(5000);} catch (InterruptedException ie){}
}}
public static void main(
String[] args) {
A a1 = new A();
long startTime = System.currentTimeMillis();
System.out.println(startTime);
a1.start();
System.out.print(System.currentTimeMillis() - startTime + ",");
try {a1.join(6000);} catch (InterruptedException ie) {}
System.out.print(System.currentTimeMillis() - startTime);
}}
Answer:
1.The first number printed is greater than or equal to 0
2.The second number printed must always be greater than 5000
Really confusing me. It would be a great help if anyone explain this?
Thanks in advance
Preparing Scjp1.5