Thursday 14 March 2013

run() Declaration:


run()
Declaration:

public void run()
Description:
If this thread was constructed using a separate Runnable run object, then that Runnable object’s run
method is called; otherwise, this method does nothing and returns.
Subclasses of Thread should override this method.
Specified By: run in interface Runnable
See Also: start(), Runnable.run()
interrupt()
Declaration:
public void interrupt()
Description:
Interrupts this thread. In an implementation conforming to the CLDC Specification, this operation is not
required to cancel or clean up any pending I/O operations that the thread may be waiting for.
Since: JDK 1.0, CLDC 1.1
isAlive()
Declaration:
public final boolean isAlive()
Description:
Tests if this thread is alive. A thread is alive if it has been started and has not yet died.
Returns: true if this thread is alive; false otherwise.
setPriority(int)
Declaration:
public final void setPriority(int newPriority)
Description:
Changes the priority of this thread.
Parameters:
newPriority - priority to set this thread to
Throws:
IllegalArgumentException - If the priority is not in the range MIN_PRIORITY to
MAX_PRIORITY.

getPriority()

See Also: getPriority(), MAX_PRIORITY, MIN_PRIORITY
getPriority()
Declaration:
public final int getPriority()
Description:
Returns this thread’s priority.
Returns: this thread’s priority.
See Also: setPriority(int)
getName()
Declaration:
public final java.lang.String getName()
Description:
Returns this thread’s name. Note that in CLDC the name of the thread can only be set when creating the
thread.
Returns: this thread’s name.
activeCount()
Declaration:
public static int activeCount()
Description:
Returns the current number of active threads in the virtual machine.
Returns: the current number of active threads.
join()
Declaration:
public final void join()
throws InterruptedException
Description:
Waits for this thread to die.
Throws:
InterruptedException - if another thread has interrupted the current thread. The interrupted
status of the current thread is cleared when this exception is thrown.

toString()
Declaration:
public java.lang.String toString()
Description:
Returns a string representation of this thread, including the thread’s name and priority.
Overrides: toString in class Object
Returns: a string representation of this thread.


No comments:

Post a Comment