how to stop a method in java code example
Example 1: java how to stop code
System.exit(0);
Example 2: java how to stop a thread
Thread t = new Thread();
try {
//{...your thread code here...}
//at the end of the 'try{}' block..
t.interrupt();
} catch (InterruptedException e) {} //or whatever Exception your Thread will launch