How do I run different threads in Java?
Posted
by Cris Carter
on Stack Overflow
See other posts from Stack Overflow
or by Cris Carter
Published on 2010-03-19T12:23:36Z
Indexed on
2010/03/19
12:31 UTC
Read the original article
Hit count: 479
Hey. I'm having some problems with threads. I understand how they work, but since they all use the same method, how do I run different threads that do completely different things, but at the same time?
To me, it seems that they always use the same standard method which makes them do the same thing.
So, let's say I have a big .txt file where I want to go through each line and do something to the line. In this case, I would like to have each thread do 1/10th of the .txt file, but I don't understand how the threads can communicate with each other, and how they could organize so each thread does the right part?
Could anyone explain or help me with this? Would be very much appreciated!
© Stack Overflow or respective owner