Program to Write to a file
import java.io.File;
import java.io.PrintStream;
public class FileWrite {
public static void main(String[] args) throws Exception {
PrintStream ps = new PrintStream(new File(args[0]));
ps.println("My new file created by java I/O");
ps.print("I'm on new line.");
ps.print("i'm still on same line.");
//ps.close();
}
}
import java.io.File;
import java.io.PrintStream;
public class FileWrite {
public static void main(String[] args) throws Exception {
PrintStream ps = new PrintStream(new File(args[0]));
ps.println("My new file created by java I/O");
ps.print("I'm on new line.");
ps.print("i'm still on same line.");
//ps.close();
}
}
Comments
Post a Comment
Post Your Valuable Comments