0

I understand that execution can continue after the main thread has ended. However, is it possible that the JVM is still running even after the main method has returned?

Evil Washing Machine
  • 1,293
  • 4
  • 18
  • 43
  • 1
    Yes, if the JVM spawns new threads, those will continue running inside the JVM. – markspace May 20 '15 at 23:25
  • The main method must have returned for the main thread to end, so your question answers itself via implication :) – FThompson May 20 '15 at 23:27
  • @Vulcan I was wondering if there's a case where the main thread has returned but the main method is still running via some kind of reflection hack or playing around with exceptions... – Evil Washing Machine May 20 '15 at 23:38
  • The main method is just a method. You can execute it whenever you want by any thread you want. The main thread is the thread used by the JVM to launch your application by invoking the main method you specify. Is that the confusion? – Sotirios Delimanolis May 20 '15 at 23:44
  • If the JVM isn't running, then execution hasn't continued. So if execution continues, the JVM must be running. – user253751 May 21 '15 at 00:24

0 Answers0