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?
|
2: |
If an interface contains three different methods, how many of them must be included in a class that implements the interface?
- None of them.
- All of them.
- 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?
- "That's not half as exciting as the Anna Kournikova screen saver I downloaded off the Web."
- "You're the wind beneath my wings."
- "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?
|
|