L10 - Runtime Exceptions Lab
Runtime Exceptions Lab Using the lecture slides as a guide,
- In a new class, instantiate an array that can hold exactly four integers
- Using a for loop, prompt the user for an integer and store the value in the array. Repeat this five times (!).
- Run your program and note the error.
- Use a try/catch block to handle the particular runtime exception that occurred.
Sample Dialog for Improved Version
Enter a number: 1
Enter a number: 2
Enter a number: 3
Enter a number: 4
Enter a number: 5
No more room!!
Your numbers are: 1 2 3 4 Goodbye!
No Comments