Sams Teach Yourself Java™ in 24 Hours (Covering Java 7 and Android)

(singke) #1
ptg7068951

Workshop 281


  1. If an interface contains three different methods,how many of them
    must be included in a class that implements the interface?
    A. None of them.
    B. All of them.
    C. I know,but I’m not telling.

  2. Yo u ’r e a d m i r i n g t h e w o r k o f a n o t h e r p r o g r a m m e r w h o h a s c r e a t e d a p r o-
    gram that handles four simultaneous tasks. What should you tell him?
    A. “That’s not half as exciting as the Anna Kournikova screensaver I
    downloaded off the Web.”
    B. “You’re the wind beneath my wings.”
    C. “Nice threads!”


Answers



  1. A.Runnablemust be used with the implementsstatement.Threadis
    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 includes all 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?


Activities


If this long workshop hasn’t left you feeling threadbare,expand your skills
with the following activities:


. If you are comfortable with HTML,create your own home page that
includes the LinkRotatorapplet and six of your own favorite websites.
Use the applet along with other graphics and text on the page.
. Add a button to the PrimeFinderapplication that can stop the thread
while the sequence of prime numbers is still being calculated.


To s e e J av a p r o g r a m s t h a t i m p l e m e n t t h e s e a c t i v i t i e s ,visit the book’s website
at http://www.java24hours.com.

Free download pdf