* Runtime对象:
* 该类并没有提供构造函数,说明不可以new对象
* 但该类中还有非静态方法,说明该类肯定会提供获取本类对象的静态方法,
* 使用了单例模式
*
* 该静态方法是 static Runtime getRuntime();
* 该类并没有提供构造函数,说明不可以new对象
* 但该类中还有非静态方法,说明该类肯定会提供获取本类对象的静态方法,
* 使用了单例模式
*
* 该静态方法是 static Runtime getRuntime();
public class RuntimeDemo {
public static void main(String[] args) throws Exception
{
//获取Runtime的对象
Runtime rt = Runtime.getRuntime();
//在notepad.exe记事本中打开SystemDemo.java文件
Process p = rt.exec("notepad.exe SystemDemo.java");
Thread.sleep(4000);
//销毁创建的进程
p.destroy();
}
}