Terminating a Java Program

后端 未结 7 1995
感动是毒
感动是毒 2020-11-27 12:03

I found out ways to terminate (shut-down or stop) my Java programs. I found two solutions for it.

  1. using return;
    When I want to quit or

相关标签:
7条回答
  • 2020-11-27 12:30

    What does return; mean?

    return; really means it returns nothing void. That's it.

    why return; or other codes can write below the statement of System.exit(0);

    It is allowed since compiler doesn't know calling System.exit(0) will terminate the JVM. The compiler will just give a warning - unnecessary return statement

    0 讨论(0)
提交回复
热议问题