Exception in thread “main” java.lang.ArithmeticException: / by zero

I have two questions about Exceptions. Firstly, I got this message from my code…

Exception in thread "main" java.lang.ArithmeticException: / by zero

This error message means dividing by zero, such as by doing int a = 5 / 0;

A method can throw an Exception class instance, can’t it? But this is an expression. Why can an expression throw an Exception class instance ?

My second question is about thread "main". What is thread "main"? Does "main" mean the static main method?

Leave a Comment

tech