package org.tarena.day02;
import java.io.FileOutputStream;
import java.io.PrintStream;
public class SystemDemo {
/**
* @param args
*/
public static void main (String[] args) throws Exception{
//将控制台的输入、输出信息写入文件当中,而不再控制台显示;
System.setOut(new PrintStream(
new FileOutputStream("/home/soft22/Desktop/aaa.txt")));
System.out.println("Hello!!");
System.setErr(new PrintStream(
new FileOutputStream("/home/soft22/Desktop/bbb.txt") ));
String str =null;
System.out.println(str.length());
}
}
[/quote]
[quote]
// 在类路径中加载资源文件
// /images/a.bmp
InputStream in = 类名.class.getResourceAsStream("/images/a.bmp");
[/quote]