System类中的方法和属性都是静态的
- out是标准输出,默认是控制台。
- in是标准输入,默认是键盘。
- getProperties 返回Properties类型,作用是获取系统属性信息。
Properties是HashTable的子类,也就是Map集合中的一个子类,可以 通过map的方法取出该集合中的子类。
import java.util.Properties;
public class SystemDemo {
public static void main(String[] args){
Properties pro = System.getProperties();
for(Object obj:pro.keySet()){
String value = (String) pro.get(obj);
System.out.println(value);
}
String value = System.getProperty("os.name");
System.out.println(value);
System.setProperty("football", "good");
System.out.println(System.getProperty("football"));
}
}