Are we there yet ? – “throws” keyword – 2nd part + checked exceptions

Welcome back people in the internet let’s continue right were we left off.

Not only do we have at our disposal , the try/catch block to catch exceptions.

Let me introduce you to :(*drum roll* ) , throws/throw keywords .

This helpful keyword , will be placed right at the end of the method’s signature .

Is there a difference between throws / throw or just the s ?

well, as it turns out throws is utilize for postponing , the handling of a checked exception ( basically procrastinating if you ask me ) . While throw is used to invoke the exception expressed.

Now , your thinking slow down there boy , I caught that. What do you mean checked exceptions ?

Turns out there’s 2 types of exceptions. Checked and unchecked exceptions. Checked exceptions will be if an exception was notify , by the all-important compiler.

Unchecked exceptions : are known as Runtime exceptions , and they happened at the time of the execution. ( bugs, not using good logic in your program )

(as always code will be available at the bottom of the page with a link to the program inside my GitHub )

yes we are, yes we are .

https://github.com/ValorWind1/Java_Review_1.0/blob/master/src/intermidiate_Java/exceptions/Throws_Demo.java

Leave a comment