in the example given below , I have not given notify yet control comes back and prints main.I thought notify is necessary.
class B implements Runnable
{
public void run()
{
for(int i=0;i<10;i++)
{
System.out.println ("Number="+i);
}
}
}
public class H
{
public static void main(
String[] args)
{
B b1=new B();
Thread t1=new Thread(b1);
t1.start();
synchronized(t1)
{
try
{
t1.wait();
}
catch(InterruptedException ex)
{
ex.printStackTrace();
}
System.out.println ("main");
}
}
}