Question
I need help defining the following exeptions using the same template as described below for each question Template: - What is a possible situation that
I need help defining the following exeptions using the same template as described below for each question
Template:
- What is a possible situation that leads to the exception?
- Who is in charge of throwing the exception: you as a programmer or the runtime system? In theory, should you throw exceptions of this type? Explain your answer.
- If you need to throw the exception, what details would you provide as a message to the user (caller)? What parameters would you include in the message?
- Can the exception be generally caught (and therefore handled)?
- If the exception occurs, should you generally catch this exception type or is it better to pass such exception to the user (caller)? It is not enough to say yes or no; you must provide an argument to support your answer.
- Is the exception a case when you want to avoid this exception to occur in your application in general? If so, what would be your actions as a programmer to avoid it?
The exeption questions:
- NullReferenceException
- IndexOutOfRangeException
- StackOverflowException
- OutOfMemoryException
- DivideByZeroException
- ArgumentNullException
- ArgumentOutOfRangeException
- FormatException
- ArgumentException
- SystemException
Step by Step Solution
There are 3 Steps involved in it
Step: 1
NullReferenceException Possible situation Trying to access a member method or property of a null object Who throws the exception The runtime system throws the exception ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started