Intro To Exceptions (What's The Difference Between Checked & Unchecked)
Transcript, Code, & Presentation
WebPage: [ Ссылка ]
GitHub: [ Ссылка ]
► Free Selenium PDF Book: [ Ссылка ]
► Free Java PDF Book: [ Ссылка ]
► All Paperback & eBooks: [ Ссылка ]
Transcript
Hello and Welcome, in this video series, I am going to talk about Exceptions. We are going to start with an introduction then discuss the difference between Checked and Unchecked Exceptions. Next, I will demo 4 Common Selenium Exceptions then show you How To Handle Exceptions.
Let’s begin with a diagram of the Exception Hierarchy. We see Throwable at the top. All exceptions are derived from the Throwable Class. Error and Exception are 2 subclasses of Throwable. Error is related to a problem in the (JVM) Java Virtual Machine while Exception is related to a problem in our program. The focus will be on Exception because an Error is beyond our control since it involves the JVM.
What is an exception? An exception is an indication that something is wrong with our program. We can explicitly throw an exception when a condition is met or the exception will happen automatically because something did not complete.
Checked and Unchecked are the 2 types of Exceptions. Checked Exceptions are exceptions checked at compile time. This means the compiler will check to make sure our syntax is correct before running our program. Unchecked Exceptions are not checked at compile time but they are checked at run time.
A better name for an Unchecked Exception is a Runtime Exception. A Runtime Exception is when the syntax is correct but the logic may not be correct. As a result, we run our program then receive an exception at the time of execution. There are so many exceptions but here’s a list of 3 Checked Exceptions and 3 Unchecked Exceptions.
We also have a list of more Checked Exceptions
and Unchecked Exceptions. I included a link to the Java Docs if you want to take a look at all of the exceptions. Click Runtime Exception and you will see more Runtime exceptions. Next, we are going to look at 4 Common Selenium Exceptions.
#IntroToExceptions #CheckedExceptions #UncheckedExeceptions #Exceptions
Ещё видео!