Java Process waitFor() MethodThe waitFor() method of Process class is used to wait the currently executing thread until the process executed by the Process object has been completed. The method returns immediately when the subprocess has been terminated and if the subprocess is not terminated, the thread will be blocked. SyntaxParameterNA ReturnThis method generally returns the exit value of the process and subprocesses. By default, normal termination is represented by 0. Example 1Output: Ms Paint will run. You have exited from Ms paint. Example 2Output: Ms Paint will run. You have exited from Ms-paint. Notepad will run. You have exited from Notepad. Example 3Output: Both Ms paint and Notepad will run simultaneously. 1. Ms Paint will run. 2. Notepad will run. You have exited from Ms-paint. You have exited from Notepad. Next TopicJava-timer |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India