Related questions
How do I exit a while loop in Java?
What is the best way to exit/terminate a while loop in Java?
For example, my code is currently as follows:
while(true){
if(obj == null){
// I need to exit here
}
}
When should we call System.exit in Java
In Java, What is the difference with or without System.exit(0) in following code?
public class TestExit
{
public static void main(String[] args)
{
System.out.println("hello world");
System.exit(0); // is it necessary? And when it must be called?
}
}
The …
Exiting a program with System.exit(0) in java
I am a little confused about how to implement System.exit(0); in my program. What I want to have happen is for the user to type the word "exit" and for the program to terminate. I would also like the …