public class WrapperTest {
static {
print(10);
}
static void print(int x) {
System.out.println(x);
System.exit(0);
}
}
In the above code System.exit(0)
is used to stop the program. What argument does that method take? Why do we gave it as 0
. Can anyone explain the concept?
From the JAVA Documentation:
The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination.
And Wikipedia adds additional information.