Java基础之IO流,打印系统信息至标准输出设备或文件中Properties.list()
import java.io.*;
import java.util.*;
class PrintPropertiesToStreamDemo
{
public static void main(String[] args) throws IOException
{
Properties ps = System.getProperties();
//打印到标准输出设置
ps.list(System.out);
//通过流打印到文件
ps.list(new PrintStream(new File("sysinfo.txt")));
}
}
import java.util.*;
class PrintPropertiesToStreamDemo
{
public static void main(String[] args) throws IOException
{
Properties ps = System.getProperties();
//打印到标准输出设置
ps.list(System.out);
//通过流打印到文件
ps.list(new PrintStream(new File("sysinfo.txt")));
}
}