1,Runtime类
-
是一个单例类
2,常见方法:
3,定时关机
import java.io.IOException;
public class Demo2_Runtime {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
Runtime r = Runtime.getRuntime(); //获取运行时对象
//r.exec("shutdown -s -t 300"); //300秒后关机
r.exec("shutdown -a"); //取消关机
}
}