首页 分享 System和Runtime

System和Runtime

来源:花匠小妙招 时间:2024-12-26 16:00

最新推荐文章于 2024-10-11 15:58:48 发布

一日看尽长安花的幻想 于 2017-12-03 18:11:44 发布

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

System中定义了一些与与系统相关的属性和方法,这些方法都是静态的,所以引用这些属性和方法,直接使用System类调用即可。

Runtime表示虚拟机的属性和方法。Runtime是采用单例模式设计,用getRuntime()获得实例对象。

Runtime中提供了exec()方法,用于执行dos命令,效果和在命令行窗口中输入dos命令的效果一样。在exec()中的命令语句要放在“”中。例如:exec("notepad.exe").

package study;
import java.io.*;
public class Example13 {
public static void main(String[] args) throws IOException{
Runtime rt=Runtime.getRuntime();
rt.exec("notepad.exe");
}
}

结果:


相关知识

System Error
第八章 免疫系统(immune system 4学时)
android 最小高度是多少,Android最小按钮高度:48dp = 9mm?
鸿蒙系统:如何使用前端技术/JS开发鸿蒙应用?
Advances in regulation and function of the bacterial type Ⅵ secretion system
Study on Precision Irrigation Decision System of Winter Wheat in Southern Xinjiang
Research progress of the composition and function of bacterial phosphotransferase system
【软件工程毕业设计】网上鲜花店
李江鹏/Handwritten digit recognition system
Effect of Subsurface Pipe Drainage System on Greenhouse Soil Improvement and Cut Chrysanthemum Quality in Continuous Cropping System

网址: System和Runtime https://www.huajiangbk.com/newsview1307592.html

所属分类:花卉
上一篇: Code=3000 “未找到应用
下一篇: 英语 | No big surp

推荐分享