What happens when java program starts?

后端 未结 4 1384
予麋鹿
予麋鹿 2021-02-02 02:42

Recently have been touched Java classloaders and suddenly recognized that do not fully understand what happens step-by-step when someone calls

j         


        
4条回答
  •  星月不相逢
    2021-02-02 03:28

    Whenever you compile a Java program the following steps takes place

    1. First the Class Loader loads the class into the JVM.
    2. After giving the command javac filename.java the compiler checks for compile time errors and if everything is fine then it will generate the .Class files(byte code).

    This will be the first phase.

    Later the interpreter checks for the runtime errors and if everything is fine without exceptions then the interpreter converts the byte code to executable code.

    First phase in java is done by the JIT compiler(Just In Time).

提交回复
热议问题