What does it mean when the main method throws an exception?

后端 未结 8 1390
轮回少年
轮回少年 2021-01-01 09:31

I\'m reviewing a midterm I did in preparation for my final exam tomorrow morning. I got this question wrong, but there\'s no correct answer pointed out, and I neglected to a

8条回答
  •  心在旅途
    2021-01-01 10:06

    The main method is not catching any exceptions, instead it handles the FileNotFoundException by throwing it to the source which invoked the main method.

    The system runtime launches the JVM classes, one specific class among the JVM classes invokes the main method.

    The handling for the main method's throws is at the mercy of the JVM classes in that case.

    • You can read about it in the Java language specification provided by Oracle.
    • Additionally you can view the source code for some of the JVMs available out there, going that path though takes you away to other programming languages,OpenJdk.

    I thought of sharing my small humbled research crust in that topic, hope it helps curious ones :)

提交回复
热议问题