Chat with us, powered by LiveChat Solution: EX-1 Create a user defined exception sub - Writemia

Solution: EX-1 Create a user defined exception sub

Solution: EX-1 Create a user defined exception sub class that accepts an integer in its constructor.  Extend the Exception class  Have a private value that is initialized by the constructor  Override toString to display a custom message that uses the private value. In a main method:  Use two text files, file1 and file2, to invoke your exception (via file1) and a general exception (via file2).  Access the files using a method discussed in chapter 13 o Prompt the user to “Enter 1 or 2” for which file they want to use for a given run. o Or, run from the command prompt and take the file name in as the first parameter  Use a try with resources block to access the file selected and trigger the exception. o For a general exception, you can force it or simply throw it directly yourself.  Catch your exception and issue a message.  Catch a general (nonspecific) exception and issue a message, then rethrow a general exception.  Use a finally clause to issue a closing message. Submit the zipped Eclipse solution folder.

Do you need an answer to this or any other questions?

About Writemia

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Place Order” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order