Thats what your if-else is for: anything that you write in the else-branch won't be executed (instructions after the else-branch still will be done).
If you really want to end your program, you can use System.exit(). This will cause the java virtual machine to stop executing, so make sure you really do this as the last instruction (for example, after your block() method).
Thank you sooo much for the reply!
1) the ELSE part will not help me because any way the rest of the code (those which are after the end of else) will be executed!!
2)I also cant use the system.exit because: there are some other classess which are running (or are to be runned later on) and If I use System.exit() they will be terminate as well.
All Im looking for, is to know a statment or what ever that can help me to stop my compiler from executing the rest of the code after that certain statement!
I even dont know If there exists such a statement??!!
There are no statements that stop the execution of a program. "break" and "continue" statements end a loop iteration, but I don't think they will help you here (since you have no loop). Can't you arrange your code such that no other instructions follow on your test?
Do you mean you have 800 lines in the same method? You can try a return statement, but you really want to refactor that method. A method that large is unlikely to have been written on object-oriented principles.
Thank you ALL!
Dear fred : My bad! you are right! its not "stop executing". I just need the thread to stop when it reachs that command!(by stop I mean tht JVM dose not execute the line after that certain command!)
Dear Campbell: Im agree with you! 800 line is so much but I need to have all of them in that method. the only thing I can do is try to encapsulate them in to some other methods and just call them in my main method! It will be more organised and modular!
Can you please introduce me an online sorce or book that can help me to know how to partition my method to some other methods?(I mostly have problem with how to access those variables which are accessible in main method but are not in new methods)