Exception, What Happens Behind the Scenes in Java

Uğur Taş
Codimis
Published in
9 min readNov 23, 2023

--

Exception : What Happens Behind the Scenes in Java

Exceptions are events that disrupt the normal flow of program execution in Java. When an exception occurs, the default behavior is for the program to halt abruptly and print out an error message. However, Java provides robust exception handling mechanisms that allow developers to anticipate and recover gracefully from exceptions.

If you don’t have a medium membership, you can use this link to reach the article without a paywall.

What is an Exception?

An exception in Java is an event that disrupts the normal flow of a program. It’s an object that represents an error or an unusual situation. Java categorizes exceptions into two main types: checked exceptions and unchecked exceptions.

There are various circumstances that trigger exceptions in Java. Firstly, They can be due to errors in code, such as trying to access an array element out of its bounds. The second possible reason is external factors, such as a file does not exist.

--

--

Uğur Taş
Codimis

A software developer with a high passion for learning, improving skills, and sharing knowledge. My motto is “fail million times if you take lessons every time”