From the course: Java Exception Handling
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Solution: Catch and handle two exceptions - Java Tutorial
From the course: Java Exception Handling
Solution: Catch and handle two exceptions
(upbeat music) - [Instructor] Your challenge for this chapter was to catch and handle two exceptions that were thrown from the fine number endpoint and the create sequence endpoint. We will walk through the solution now. Let's start with the create sequence endpoint on line 34. On line 36, we are calling the store Sequence method. This method can be found on line 83. We see here that this method is also throwing an IO exception. and that is because of our use of the file object and file writer objects in this method on lines 85 and 91. Back on line 36, this is where we're going to start our tri-catch clause. In our tri-statement we want to try the same store sequence method here. And since this store sequence method is returning a file name, we'll actually define that file name above, outside of our tri-catch statement. And on line 38, we'll set that variable to the result that is returned from the store sequence…