Code:public class Airport { public static void main(String[] args) throws InterruptedException { passenger p = new passenger(); p.start(); synchronized (p) { System.out.println("passenger is waiting for the plane "); p.wait(6000000); System.out.println("passenger notify"); } System.out.println("after "+p.total+" time!"); } } class passenger extends Thread { int total = 0; public void run() { synchronized (this) { System.out.println("wait.... "); /*try { wait(); } catch (InterruptedException e) {}*/ for (int i = 0; i <= 10; i++) total = i; if ( total==10){ System.out.println("passenger is given notification call"); //notify(); } } } }
1-This program must wait for 6000 seconds, But it does not!! Why?
2-In line 7, Is this main thread that must wait for 6000 seconds?Or thread who runs run method?