Activities

To see whether you are an exceptional Java programmer, try to make as few errors as possible in the following activities:

  • Modify the DivideNumbers application so that it throws any exceptions that it catches, and run the program to see what happens.

  • There's a try-catch block in the LottoEvent class you created in Hour 15, “Responding to User Input.” Use this block as a guide to create your own Sleep class, which handles InterruptedException so other classes like LottoEvent don't need to deal with them.

To see Java programs that implement these activities, visit the book's website at http://www.java24hours.com.

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION 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.