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

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -