package com.betasoft.test;
import java.io.FileNotFoundException;
import java.io.PrintStream;
public class DemoEight {
public static void main(String[] args) {
try {
PrintStream ps = new PrintStream("D:/f.txt");
System.setOut(ps);
System.out.println("我的测试,输出到hello.txt");
System.out.println(new DemoEight());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
import java.io.FileNotFoundException;
import java.io.PrintStream;
public class DemoEight {
public static void main(String[] args) {
try {
PrintStream ps = new PrintStream("D:/f.txt");
System.setOut(ps);
System.out.println("我的测试,输出到hello.txt");
System.out.println(new DemoEight());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}