Visual Exception Handling Excercise
The Throw Down
Give the title of your exercise, which may include the name of the topic you are covering, or some other catchy title.
The problem
Describe what you are attempting to teach students by this exercise.
Participants and Props
One class member will participate in the activity at a time. There will be one large tray, labeled Exception. There will be two medium-sized buckets labeled ClassCastException and IO Exception, and one small bucket labeled FileNotFound. Cards with different lines of code for each student will be written prior to class. A tennis ball, representing...., will also be used.
Instructions
Students will come up one at a time and be given a card with code written on it. Equal numbers of cards will be provided for students. They will also be given the tennis ball. The student will then decide which exception handling method should be used to fix the code and attempt to throw the tennis ball into the appropriate bucket/bin. If they make the bucket and it is the right exception, they will be awarded one point. The student with the most points at the end of the game wins.
Acknowledgments
This exercise was created by ... and John Phillips