I found out ways to terminate (shut-down or stop) my Java programs. I found two solutions for it.
using return;
When I want to quit or
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