Technically, yes you can do it that way, but in almost all cases it's an utterly horrible hack and should be avoided by changing your program's design. System.exit() is for when things have gone absolutely unrecoverably wrong and the program needs to shut down to get out of whatever bad state it's in, not for the normal and routine end of program execution.
I get the feeling that your actual main issue is poor conceptual design of how the program is supposed to work in general, and there's a lot of missing context that we'd need to be able to advise you on that.