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 terminate my program execution , I add this.
- using System.exit() ; 
 Sometimes I used it. I read about System.exit() from this question.
So, I know a little on both them. But I am still confused as to how they actually work. Please check below codes...
public class Testing {
public static void main(String... str) {
    System.out.println(1);
    System.exit(0);
    System.out.println(2);
    return;
 }
}
I am sure that 2 will not appear. I would like to know is why return; or other codes can write below the statement of System.exit(0); and what was real definition for return; (because it is strange thing for me return without any variables or values) ?
 
     
     
     
     
     
     
     
    