Chapter 4Handling Exceptions

  1. Fill in the blanks: The ___________________ keyword is used in method declarations, whereas the ___________________ keyword is used to send an exception to the surrounding process.
    1. throwing, catch
    2. throws, throw
    3. catch, throw
    4. throws, catch
    5. throw, throws
    6. catch, throwing
  2. What is the output of the following application?
    package paper;
    import java.io.Closeable;
    public class PrintCompany {
       class Printer implements Closeable {     // r1
          public void print() {
             System.out.println("This just in!");
     } ...

Get OCP Oracle Certified Professional Java SE 17 Developer Practice Tests now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.