Hey Friends, the code is a simple example of using printstream class in Java:
Print.java
import java.io.*;
class Printstream {
 public static void main(String args[]) throws FileNotFoundException
 {
  PrintStream p=new PrintStream("File1.txt");
  p.println("Hello this is written to the file using print stream");
  p.println("Again the next line is also written to the file");
  System.out.println("\nData is successfully written to the file");
 }
}
Have Fun.............

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.