Day 44/100 of #100DaysOfCode , #100daysofcodechallenge , #Coding
- How Exceptions Work in Java
- How Exceptions Work in Java
First thing first.
What , why and how exception handling is done is Java. 👇👇
What , why and how exception handling is done is Java. 👇👇
Let's learn more about how Java exceptions work.
When an abnormal condition arises in a Java program
For example,
int a = 9/0 // According to math rules, this is invalid, the denominator can't be 0
When this statement is executed by the JVM, An arithmetic exception is raised.
When an abnormal condition arises in a Java program
For example,
int a = 9/0 // According to math rules, this is invalid, the denominator can't be 0
When this statement is executed by the JVM, An arithmetic exception is raised.
When an exception occurs in a program,
Java searches the current thread for an uncaught exception handler; if it cannot, the exception is navigated to the default exception handler given by Java, which prints the exception message and method call stack.
Java searches the current thread for an uncaught exception handler; if it cannot, the exception is navigated to the default exception handler given by Java, which prints the exception message and method call stack.
That's all for this thread.
Play around with this and create your own handler and see how it works.
Next we will talk about types and custom exceptions.
Stay tuned, Follow
@java_experts
, if you haven't done yet.
Like and RT below thread to appreciate
Play around with this and create your own handler and see how it works.
Next we will talk about types and custom exceptions.
Stay tuned, Follow
@java_experts
, if you haven't done yet.
Like and RT below thread to appreciate
Loading suggestions...