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();
    }
}
 

Comments

Popular posts from this blog

Zeller's Congruence

Property Event-Delegation

Method with variable arguments