Shutdown / restart computer

import java.io.IOException;
import java.util.Scanner;

public class ShutdownRestart {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        Runtime runtime = Runtime.getRuntime();

        System.out.print("Press 1 to shut down the computer or 2 to restart it: ");
        int choice = scan.nextInt();

        scan.close();

        try {
            switch (choice) {
                case 1:
                    System.out.println("System shutdown after 10 seconds.");
                    runtime.exec("shutdown -s -t 10");
                    break;
                case 2:
                    System.out.println("System restart after 10 seconds.");
                    runtime.exec("shutdown -r -t 10");
                    break;
                default:
                    System.out.println("Incorrect input");
                    break;
            }
        } catch (IOException e) {
            System.out.println("Exception: " + e);
        }

    }
}
Output
Press 1 to shut down the computer or 2 to restart it: 1
System shutdown after 10 seconds.