Actually before Threading , I used to know that after calling System.exit(0) , the program stops to work and exits and even after reading the System.exit(0) , I am getting SOPs means still some thread is running . So in this point I am getting confused like how I am getting SOPs after System.exit(0) , is it like even after System.exit command , the compiler does not shut down the code if in case any other threads is still have the value.
System.exit() begins the 'normal shutdown' procedure which includes executing shutdown hooks and finalizers. If any of these hooks/finalizers call System.out.println() then the output may be recorded. Also, and especially of you have a lot of output statements in a tight loop, the output to System.out.println() is buffered which means the output may be stored for a brief time before being sent to the console. So if you shutdown that output stream is generally flushed and any stored output would be pushed to the console.