Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6
You can throw an exception from main, but where would you catch it? The JVM handles all uncaught exceptions. When an exception is thrown it can either be handled directly within the method in which it was thrown or passed up the method call stack until it reaches a method that handles it. If not handled in any method prior to main or within main then it will be thrown from main to the JVM to be handled.
15th May 2020, 8:56 AM
ChaoticDawg
ChaoticDawg - avatar
15th May 2020, 8:28 AM
A͢J
A͢J - avatar