thread
I have to build a class using Thread.
This class will have a method called log(String str). This
String will be passed into this method from application to store
it into a file. I have to use thread so that application does
not have to wait until I am done writing lgging record to a file.
Since I am new in Thread, if anybody help me to implement this,
it will be great.
[428 byte] By [
vincmac] at [2007-9-26 14:21:04]

There are two ways to create threads. You can extend the Thread class (java.lang.Thread), or you can make a new class that implements Runnable (java.lang.Runnable) and create a generic Thread using an object of your Runnable class.
class YourThread extends Thread {
...
}
class YourThread implements Runnable {
...
}
In either case, you need to have a method called run which does whatever it is the thread is supposed to do...
public void run() { ... }
In your case, your run method is going to wait for someone to call log(String str) and then do something with that String. I suggest you look at the following in the Java language and API documentation:
synchronized keyword
Object.wait()
Object.notify()
java.io.FileOutputStream
That should give you some ideas on how to proceed. If you need more help just ask.