Thread Class Methods Flashcards

1
Q

Returns reference to the current thread.

A

Thread.currentThread()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Returns the name of the current thread.

A

String getName()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Returns the priority value of the current thread.

A

int getPriority()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The current thread invoking this method on another thread waits until the other thread dies. Overloaded to be able to give the timeout in milliseconds or milliseconds and nanoseconds.

A

void join()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Once you start a thread using the start() method, this method will be called when the thread is ready to execute.

A

void run()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Changes the name of the thread to the given name in the argument.

A

void setName(String name)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Sets the priority of the thread to the given argument value.

A

void setPriority(int priorityValue)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Makes the current thread sleep for given milliseconds or milliseconds and nanoseconds.

A

Thread.sleep(long milliseconds, int nanoseconds)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Starts the thread; JVM calls the run() method of the thread.

A

void start()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Overridden method of Object that returns the string representation of the thread. Has the threads name, priority, and group.

A

String toString()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly