Hello, in this Java programming video, we are going to look at the multi catch block. So the multi catch block is very similar to what we covered in the simple example video in exception. If you haven't checked that out, feel free to take a look at that tutorial voted on that feel free to call back. Okay, let's try catch block, try the bit of code tries to catch particular exception multicast block. It can handle multiple catches, or, you know, multiple different exceptions, because the exception we have here is array index out of bounds exception. So when you have an invalid index that you're trying to refer to, but if for example, all I did for common descent, and I did something that's new variable, and it doesn't have to be in relation to the ratio.
So you do divide by zero for example. As you can see from an arrow division by zero, and it's also given us the exception right here. So what we can do is to catch this on just handle stuff like division by zeros, other riff Matic problems as well. But the main one that is useful for is, you know, division by zero arithmetic exception. So if you're wondering how I'm getting the autocomplete, you press control and space, you'll either come up like so if you type enough like arithmetic was on roof is only the one anyway. But if he was wondering, and I learned this system with a print error, or I'm also going to do them time to learn, and I'm going to invite someone else in the I'm going to say Mac error and the system dock.
And I'm gonna say here I'm not Matt Farah, right in my own custom area. So you can see that is going into the void catch block. So we're going to write catch block, you know, we've printed out this problem, which is the, you know, the default for our print, and it's got the end as well forward to on this and it printed array index error, because it's out of bounds. That's something to bear in mind. So if it hits a problem, an error, you'll go to the catch block and long run the rest of the code in the try block. So the assumption is the rest of the code should be dependent on you know, the previous line the code in the try block, and therefore if something goes wrong, With one of those lines, and you catch the exception of handling accordingly, you shouldn't run the rest of the code or your handling and run it maybe within the catch block.
But that's it for multiple catch blocks. If you want to add more, the process is exactly the same. Thanks for watching all of the code from this video and all of the other videos in this series will be on GitHub and a link to that will be with this tutorial. If you have any questions, feel free to reach out and I look forward to seeing you in the next awesome Java video.