Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ASAP, PLEASE HELP ME Multithreading is supported by the: Thread interface Runnab

ID: 3809163 • Letter: A

Question

ASAP, PLEASE HELP ME

Multithreading is supported by the:

Thread interface

Runnable class and the Thread interface

Thread class and the Runnable interface

Runnable class

When creating a runnable object, why might you want to extend Thread rather than implement Runnable?

When you want to override one or more of Thread’s methods other than run().

When you want to overload one or more of Thread’s methods such as run()

Both a and b are correct

When you want to instantiate the runnable object.

Show how to use join() to wait for a thread object called MyThrd to end

Thread MyThrd.join();

Object MyThrd = MyThrd.join();

join().MyThrd;

MyThrd.join();

Show how to set a thread called MyThrd to three levels above normal priority
MyThrd.setPriority(Thread.NORM_PRIORITY , 3);

MyThrd.setPriority(Thread.NORM_PRIORITY + 3);

MyThrd.setPriority(Above.NORM_PRIORITY, 3);

MyThrd.setPriority(Above.NORM_PRIORITY + 3);

Adding synchronized to a method allows only one thread at a time to use the method for any given object of its class.

True or false ?

The wait() and notify() methods are used to perform

synchronized communication

outerthread communication

innerthread communication

interthread communication

What method defined by Thread obtains the name of a thread?

SetName(0

readName()

loadName()

getName()

What does isAlive() return?

true if the invoking thread is still running

true if the invoking thread has been initialized

false if the invoking thread has been terminated

either A or C

Why can’t you use suspend(), resume(), and stop() for new programs?

The three methods have been deprecated because they can cause serious logic problems

You can you use suspend(), resume(), and stop() for new programs with no problems

The three methods have been deprecated because they can cause serious run-time problems.

The three methods have been deprecated because they can cause serious compile-time problems

Exception UnknownHostException occurs when:

a hostname indicated by a client cannot be resolved to an address.

a client name indicated by a host cannot be resolved to an address.

a hostname not indicated by a client cannot be resolved to an address.

a client name not indicated by a host can be resolved to an address.

MyThrd.setPriority(Thread.NORM_PRIORITY + 3);

MyThrd.setPriority(Above.NORM_PRIORITY, 3);

MyThrd.setPriority(Above.NORM_PRIORITY + 3);

Adding synchronized to a method allows only one thread at a time to use the method for any given object of its class.

True or false ?

The wait() and notify() methods are used to perform

synchronized communication

Explanation / Answer

Multithreading is supported by the:

   Thread class and the Runnable interface

Adding synchronized to a method allows only one thread at a time to use the method for any given object of its class.

true

Show how to use join() to wait for a thread object called MyThrd to end

MyThrd.join();

Show how to set a thread called MyThrd to three levels above normal priority

MyThrd.setPriority(Thread.NORM_PRIORITY + 3);

The wait() and notify() methods are used to perform

interthread communication

What method defined by Thread obtains the name of a thread?

getName()

What does isAlive() return?

true if the invoking thread is still running

Why can’t you use suspend(), resume(), and stop() for new programs?

The three methods have been deprecated because they can cause serious run-time problems.

Exception UnknownHostException occurs when:

a hostname indicated by a client cannot be resolved to an address.

MyThrd.setPriority(Thread.NORM_PRIORITY + 3);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote