Question: Write any two differences between the keyword throw and throws. Write a Java program that prompts the user to enter a number to use as

Write any two differences between the keyword "throw" and "throws". Write a Java program that
prompts the user to enter a number to use as an array size, and then attempt to declare an array
using the entered size. If the array is created successfully, display an appropriate message. Java
generates a User defined exception namely Check if you attempt to create an array with a negative
size. Use a catch block that executes if the array size is negative, displaying a message
IncorrectArraySizeException that indicates the array was not created.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!