Answers for "how to shut down the compuer java"

0

how to shut down the compuer java

/* Java Program Example - Shutdown Computer */
      
import java.io.*;

public class JavaProgram
{
    public static void main(String args[]) throws IOException
    {
        Runtime runtime = Runtime.getRuntime();
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
      
        System.out.print("Enter No. of Seconds after which You want your Computer to Shutdown :");
        long a=Long.parseLong(br.readLine());
      
        Process proc = runtime.exec("shutdown -s -t " +a);
      
        System.exit(0);
    }
}
Posted by: Guest on September-22-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language