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
System.exit() terminates the JVM. Nothing after System.exit() is executed. Return is generally used for exiting a method. If the return type is void, then you could use return; But I don't think is a good practice to do it in the main method. You don't have to do anything for terminate a program, unless infinite loop or some strange other execution flows.