how to shut down the compuer java

Solutions on MaxInterview for how to shut down the compuer java by the best coders in the world

showing results for - "how to shut down the compuer java"
Payton
26 Jul 2017
1/* Java Program Example - Shutdown Computer */
2      
3import java.io.*;
4
5public class JavaProgram
6{
7    public static void main(String args[]) throws IOException
8    {
9        Runtime runtime = Runtime.getRuntime();
10        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
11      
12        System.out.print("Enter No. of Seconds after which You want your Computer to Shutdown :");
13        long a=Long.parseLong(br.readLine());
14      
15        Process proc = runtime.exec("shutdown -s -t " +a);
16      
17        System.exit(0);
18    }
19}