I know a bit about threads in ‘C’ but am new to them in Java. If I want to create three threads, one for addition, second for subtraction and third for multiplication I can simply do
pthread_t mathThread[3];
and while creating each thread I can assign them different functions in their arguments.
void *add(void *arg);
void *sub(void *arg);
void *mul(void *arg);
In Java, if I implement the Runnable interface there is only one run() method that I can use. How do I implement the above?
Create three different runnables: