In java this is valid
new Thread(new Runnable()
{
public void run()
{
for(int i=0;i<5;i++)
System.out.println("From anonymous:"+i);
}
}
).start();
But this is not :
Thread t=new Thread(new Runnable()
{
public void run()
{
for(int i=0;i<5;i++)
System.out.println("From anonymous:"+i);
}
}
).start();
can I achieve it with anonymous class? If yes then How
startmethod just runs the thread. Andrunmethod does not return any value.