java - multiple threads performing different tasks -
this first time writing multiple threaded program. have doubt multiple thread i'l create point same run method , perform task written in run(). want different threads perform different tasks e.g 1 thread insert database other update , etc. question how create different threads perform different tasks
create threads different jobs:
public class job1thread extends thread { @override public void run() { // job 1 here } } public class job2thread extends thread { @override public void run() { // job 2 here } }
start threads , work you:
job1thread job1 = new job1thread(); job2thread job2 = new job2thread(); job1.start(); job2.start();
Comments
Post a Comment