File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes 4 Threads Synchronized Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "4 Threads Synchronized" Watch "4 Threads Synchronized" New topic
Author

4 Threads Synchronized

Mg Oo
Greenhorn

Joined: Nov 28, 2004
Posts: 22
Please help me with the following quizz.
----------------------------------

A Java Program uses four threads. The first three threads each read a text file
and count the number of times that a given word is used in the text file.
The words which are to be counted are provided on a command line as shown when
the execution of the program is initiated : :

java countIt hello world me


The above line shows that countIt is the program being executed.
The first thread object counts the word 'hello, the second 'world' and the
third 'me'

Each of the thread objects communicates its findings to the fourth thread object which displays the results in a JTextArea as below : :

hello 4
world 9
me 3

Note that the words appear in alphabetical order.

---------------------------------------------------

The same functions for three threads ?
Synchronized four threads or synchronised after three threads job done ?
or Fourth threads Monitar execution of each thread ?

Thanks.
[ April 19, 2006: Message edited by: Mg Oo ]
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3011
    
    9
What was wrong with the answers you got the first time you asked this question ?


Joanne
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: 4 Threads Synchronized
 
Similar Threads
Thread that gets the value from 3 Threads
doubt in thread: notifyAll()
java
need help i have assighment to finish before end of day
Quession obout synchronized