Java Inner Thread

12/11/10 Permalink

Sometimes it's more convenient to run a thread inside the current code flow. Here's how to do this:

public void someMethod(){
    Thread t = new Thread(){
	public void run(){
		try{
                   //do stuff
		}catch(Throwable t){
		     t.printStackTrace();
		}
	}
    };
    t.start();	
}
Share It: Digg | del.icio.us | Furl | reddit | Facebook | Yahoo! | Send to Phone

mobile-utopia.com | Feedback