package cn.itcast_06;
import java.io.IOException;
/*
*
* Runtime:每个Java应用程序都有一个Runtime类实例,使应用程序与其运行环境连接
* exec(String name)
* 调取密令
*
*/
public class 单例模式的Java代码体现Runtimo {
public static void main(String[] args) throws IOException {
Runtime r = Runtime.getRuntime();
//r.exec("winmine");
//r.exec("notepad");//打开记事本
//r.exec("calc");//打开计算器
//r.exec("shutdown -s -t 10000");//关机密令
//r.exec("shoutdown -a");//取消关机密令
}
}
/*
*
*class Runtime{
* private Runtime(){}
* private static Runtime currenRuntime = new Runtime();
* public static Runtime getRuntime(){
* return currenRuntime;
* }
* }
*
*
*
*/