can we use System.exit(0) for handling the constraints of the problem in java?

can we use System.exit(0) for handling the constraints of the problem in java?