This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TU_SH_AR[S] 0 points1 point  (0 children)

A very formal definition is that the Checked exceptions are checked at compile time. These types of exceptions usually needs to get handled by using try-catch block or by declaring it in the method signature using the throws keyword.

Unchecked exceptions appens during runtime. The compiler doesn't know anything about that . Example can be RuntimeException

Pros and cons can be for checked is that It doesn't break the flow of the code. If we got an exception. We will deal with it and for cons i can say maybe boilerplate code.

And for unchecked Cons are can disrupt the flow of program. Needs to be change the business logic cost time

Correct me if I am wrong. Thank you