This Test will cover the basic introduction threads, its properties and the complete Multithreading feature of Java.
wait()
, notify()
, and notifyAll()
methods ?
class MyThread extends Thread { public static void main(String[] args) { MyThread my = new MyThread(); Thread t = new Thread(my); t.start(); } public void run() { for(int i=0; i< 3; i++){ System.out.println(i+".."); } } }
public class Test implements Runnable { public void run() { System.out.println("r1 "); System.out.println("r2 "); } public static void main( String[] args ) { Thread t = new Thread(new Test()); t.start(); System.out.println("m1 "); t.join(); System.out.println("m2 "); } }
A situation where two or more threads are blocked forever and waiting for each other to release resources.
/java/tests/7