How to shutdown or restart your computer system with the help of Java using Runtime class.
This basic program is to shut down or restart the computer system using java.
This program imports the Runtime and IOException classes of Java which are inbuilt classes.
Runtime is available in java.lang package. It is a singleton class, meaning only one instance of the Runtime class can be created in one application program.
We will use the .getRuntime() method to return the instance of this singleton class.
We also give IOException which gives an error if any failed or interrupted I/O operation exists.
Submitted by Satvik Singh Sengar (satviksinghsengar)
Download packets of source code on Coders Packet
Comments