How does Java run() method work?

后端 未结 4 721
陌清茗
陌清茗 2021-02-15 10:04

Multi-threading in Java is done by defining run() and invoking start().

Start delegates to a native method that launches a thread through operating system routines and

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-15 11:01

    I haven't looked at the internals of the JVM, but I would guess that the JVM instantiates the main thread to run the main method, but runs this main thread by invoking native code directly, without going through the classical Java classes and methods to start the thread.

提交回复
热议问题