Exceptions are errors that happen during runtime. They can crash your app if you don't handle them properly. Hereโs how you avoid that disaster:
Finally block always runs, no matter what โ even if no exception is thrown.
Try - Run the code that might throw an exceptionCatch - Handle the exception when it occurs (e.g., divide by zero)Finally - Code that always runs, regardless of an exceptionCatch ex As Exception catches all exceptions, but itโs best to catch specific ones to handle them properly!
FileNotFoundException โ when a file isn't foundNullReferenceException โ when you're trying to use an object that is nullIndexOutOfRangeException โ when you try to access an invalid index in an array