Quiz

Set aside your threads (in the Java sense, not the nudity sense), and answer the following questions about multithreading in Java.

Questions

1:

What class must be implemented for a program to use threads?

  1. Runnable
  2. Thread
  3. Applet
2:

If an interface contains three different methods, how many of them must be included in a class that implements the interface?

  1. None of them.
  2. All of them.
  3. I know, but I'm not telling.
3:

You're admiring the work of another programmer who has created a program that handles four simultaneous tasks. What should you tell him?

  1. "That's not half as exciting as the Anna Kournikova screen saver I downloaded off the Web."
  2. "You're the wind beneath my wings."
  3. "Nice threads!"

Answers

A1:

a. Runnable must be used with the implements statement. THRead is used inside a multithreaded program, but it is not needed in the class statement that begins a program.

A2:

b. An interface is a guarantee that the class will include all of the interface's methods.

A3:

c. This compliment could be confusing if the programmer is well-dressed, but let's be honest—what are the chances of that?

      
Comments