0% found this document useful (0 votes)
18 views3 pages

Java Thread Class Methods

The document outlines the methods of the Java Thread class, detailing their modifiers, types, and descriptions. Key methods include 'start()' to initiate a thread, 'run()' for executing actions, and 'sleep()' to pause a thread. Additional methods provide functionalities for thread management, such as priority setting, name retrieval, and checking thread status.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

Java Thread Class Methods

The document outlines the methods of the Java Thread class, detailing their modifiers, types, and descriptions. Key methods include 'start()' to initiate a thread, 'run()' for executing actions, and 'sleep()' to pause a thread. Additional methods provide functionalities for thread management, such as priority setting, name retrieval, and checking thread status.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Java Thread Class Methods

S.N. Modifier and Method Description


Type

1) void start() It is used to start


the execution of
the thread.

2) void run() It is used to do an


action for a
thread.

3) static void sleep() It sleeps a thread


for the specified
amount of time.

4) static Thread currentThread() It returns a


reference to the
currently
executing thread
object.

5) void join() It waits for a


thread to die.

6) int getPriority() It returns the


priority of the
thread.

7) void setPriority() It changes the


priority of the
thread.

8) String getName() It returns the


name of the
thread.

9) void setName() It changes the


name of the
thread.

10) long getId() It returns the id of


the thread.

11) boolean isAlive() It tests if the


thread is alive.

12) static void yield() It causes the


currently
executing thread
object to pause
and allow other
threads to
execute
temporarily.

13) void suspend() It is used to


suspend the
thread.

14) void resume() It is used to


resume the
suspended
thread.

15) void stop() It is used to stop


the thread.

16) void destroy() It is used to


destroy the
thread group and
all of its
subgroups.

You might also like