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

(singke) #1
ptg7068951

Workshop 263

Workshop


Although this hour is literally filled with errors,see if you can answer the fol-
lowing questions about them without making any errors of your own.


Quiz



  1. How many exceptions can a single catchstatement handle?
    A. Only one.
    B. Several different exceptions.
    C. This answer intentionally left blank.

  2. When are the statements inside a finallysection be run?
    A. After a try-catchblock has ended with an exception
    B. After a try-catchblock has ended without an exception
    C. Both

  3. With all this talk about throwing and catching,what do the Texas
    Rangers need to do in the off season?
    A. Get more starting pitching.
    B. Sign a left-handed power-hitting outfielder who can reach the
    short porch in right.
    C. Bring in new middle relievers.


Answers



  1. B.AnExceptionobject in the catchstatement can handle all excep-
    tions of its own class and its superclasses.

  2. C.The statement (or statements) in a finallysection always are exe-
    cuted after the rest of a try-catchblock,whether an exception has
    occurred.

  3. A.Every answer is correct,but A is more correct than the others and
    will probably be correct for the next 30 years.

Free download pdf