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.
Save your time - order a paper!
Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlinesOrder Paper Now