Sams Teach Yourself Java 2 in 24 Hours

Sams Teach Yourself Java 2 in 24 Hours

By Rogers Cadenhead

Questions

  1. What interface 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

  1. 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.
  2. b. An interface is a guarantee that the class will include all of the interface's methods.
  3. c. This compliment could be confusing if the programmer is well-dressed, but let's be honest—what are the chances of that?

Share ThisShare This

Informit Network