Please respond with a minimum of at least 150 words
Sorting exceptions into two categories (namely “unchecked” and “checked” exceptions) can significantly change how we handle exceptions within our program.
Checked exceptions are exceptions that occur at compile-time. These exceptions occur due to factors or events that are outside of our program’s immediate control–such as network issues, Input/Output device issues, files not being found when called, etc. Checked exceptions must either be dealt with inside of the method in which they are thrown, or else they must be passed up to an exception handler in higher-up method (by adding a “throws” clause in the method’s argument parameter).
Because of this ability to pass the exception to another method, these types of exceptions have the potential to be ignored or “swallowed” (as some of the material has dubbed), although this is not recommended of course. These exceptions should be dealt with in some way within our program wherever absolutely possible utilizing try-catch blocks or try-catch-finally blocks.
Unchecked exceptions are exceptions that occur at run-time. These consist of exceptions that deal with issues within our actual program code (or possible issues due to the user’s interaction with our code). Examples of these would be trying to access an element outside of a specified array, attempting to divide a number by 0, or a user attempting to input a letter or string into an input box designed to accept an integer.
These types of exceptions are dealt with on an “as-needed” basis, one might could say, as they attempt to catch specific errors that can spring up from the execution of buggy code. Thoroughly testing our code and being aware of the different types of exceptions that could occur within our code (and then properly handling them) can keep our code functioning smoothly and efficiently.
When it comes to which method I would prefer:
The geeksforgeeks.com website reads that throwing checked exceptions may be a better option if the user has a decent amount of control over recovering from the exceptions, and if not, unchecked exceptions are better used. It also appears that checked exceptions can allow for more robust code, although (as stated earlier), this does give programmers the opportunity to pass the buck and not deal with certain exceptions simply because they do not want to be thorough. But I also found from my research that some languages (such as C#) do not have checked exceptions, and that language appears to work well without them.
Reflecting upon my researching of this subject, (and my limited experience utilizing exceptions in my own code in my last course), I feel as though I would be more inclined to utilize unchecked exceptions, when possible. I think it makes more sense to be able to address the exceptions as needed rather than “covering the entire code with ‘throws’ clauses” as the infoworld.com website puts it. Although, I am totally new to this realm, so I’m sure I’ll learn more as I go!
Thanks for reading, all and best of wishes in the module!
We value our customers and so we ensure that what we do is 100% original..
With us you are guaranteed of quality work done by our qualified experts.Your information and everything that you do with us is kept completely confidential.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
The Product ordered is guaranteed to be original. Orders are checked by the most advanced anti-plagiarism software in the market to assure that the Product is 100% original. The Company has a zero tolerance policy for plagiarism.Read more
The Free Revision policy is a courtesy service that the Company provides to help ensure Customer’s total satisfaction with the completed Order. To receive free revision the Company requires that the Customer provide the request within fourteen (14) days from the first completion date and within a period of thirty (30) days for dissertations.Read more
The Company is committed to protect the privacy of the Customer and it will never resell or share any of Customer’s personal information, including credit card data, with any third party. All the online transactions are processed through the secure and reliable online payment systems.Read more
By placing an order with us, you agree to the service we provide. We will endear to do all that it takes to deliver a comprehensive paper as per your requirements. We also count on your cooperation to ensure that we deliver on this mandate.Read more