When passed an array of int values, a method named avgValue returns an int representing the mean average of the numbers within the array. If an invalid array index is encountered, the method will throw an ArrayIndexOutOfBoundsException . Code the statements needed to call the avgValue method to display the average number in an int array named numbers . If some other exception occurs, display the message associated with the exception. A try block contains three statements.
Exception handling is more efficient than if - else logic.
If you are working on the Internet, click here to download the folder in .zip format. You will need to extract its contents before you can build and execute it. We will review this sample program in class.