Is there any reason why I should avoid calling methods in System.exit() like in the example code below?
public class RBS {
int processClients() {
...
return 0;
}
public static void main(String[] args) {
RBS myBank = new RBS("Royal Bank of Scotland");
System.exit(myBank.processClients());
}
}
The java.lang.System.exit() method terminates the currently running Java Virtual Machine.
the declaration for java.lang.System.exit() method
public static void exit(int status)//Should be an int value.
where status -- This is the exit status.
here you are using value of your method means myBank.processClients(). So exit value is return value 0 of the above method
For more
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With