How does Java run() method work?

后端 未结 4 1813
囚心锁ツ
囚心锁ツ 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 10:59

    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.

提交回复
热议问题