Tuesday, 28 February 2017

How to use Java for ShutDown Computer From using Code

//******************Start**************************

import java.io.*;

/**
 *
 * @author HP
 */
public class Shut_Down_Computer {
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);
    }
}


//******************End***************************

No comments:

Post a Comment

Welcome, happy learning

Charactor_At_Position

public class Char_At_Position { public static void main(String[] args) { String str = "Wankhede"; String rev=""...