package RuntimeApi;
import java.io.IOException;
public class RuntimeDemo {
public static void main(String[] args) throws IOException {
/*
* Runtime:没有构造方法摘要,说明该类不可以创建对象
* 又发现还有非静态的方法 说明该类应该提供静态的返回该类对象的方法
* 而且只有一个 说明Runtime类使用了单例设计模式
*
* */
Runtime r=Runtime.getRuntime();
//execute:执行 xxx.exe
r.exec("notePad.ext");
r.exec("notepad.ext c:\\aaa.java");
Process p=r.exec("notepad.exe");
p.destroy();
}
}
Java RuntimeApi
最新推荐文章于 2024-04-10 20:58:29 发布