import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
public class InputOutputDemo {
public static void main(String[] a) throws Exception {
PrintWriter pwr = new PrintWriter(new FileWriter("java2s.txt"));
pwr.print(4711);
pwr.print(' ');
pwr.print("Java Source and Support at www.java2java.com");
pwr.close();
StreamTokenizer stok = new StreamTokenizer(new FileReader("java2s.txt"));
int tok = stok.nextToken();
while (tok != StreamTokenizer.TT_EOF) {
System.out.println(stok.sval);
tok = stok.nextToken();
}
}
}
|