5 Exception Advantages Java Developers Should Know

Advantages of Java exceptions that help create better error handlers

Milos Zivkovic
Javarevisited

--

Photo by Karolina Grabowska from Pexels

Error handling makes a lot of a developer’s workday. We fix bugs, investigate errors, and create handling routines.

Bug fixing holds a lot of responsibility. Depending on the context, consequences can cost billions of dollars. James Gosling shares his friend story:

James Gosling: If you’re writing transaction reconciliation software for some bank, you could find that oh, thirteen billion dollars leaked out of some system because of a bug. I actually had a friend who basically lost thirteen billion dollars in one night because of a bug.

What are the advantages of exceptions? What benefits exceptions bring over error codes? What you don’t know about exceptions? What’s the difference between error and exception in Java?

Let’s answer these. Let’s dive in.

Separation of error-handling

Error codes are still valid in the procedural world. Valid for error handling. So you can see blocks like these in C programs:

--

--