import java.io.*;
public class WriteFile {
public static void main(String args[]) throws IOException
{
File f=new File(args[0]);
byte b=01;
if(!f.exists())
System.out.println("\n"+args[0] +" is New File");
else
System.out.println("\n"+args[0]+ " is exists,will be overwritten.");
System.out.print("\nOpening file "+args[0]);
FileOutputStream f2=new FileOutputStream(f);
System.out.println("\nFile Opened,Now Writting Contents "+args[0]);
f2.write(b);
f2.flush();
System.out.println("\nContent Written..");
System.out.println("\nFile Closing..");
f2.close();
}
}
public class WriteFile {
public static void main(String args[]) throws IOException
{
File f=new File(args[0]);
byte b=01;
if(!f.exists())
System.out.println("\n"+args[0] +" is New File");
else
System.out.println("\n"+args[0]+ " is exists,will be overwritten.");
System.out.print("\nOpening file "+args[0]);
FileOutputStream f2=new FileOutputStream(f);
System.out.println("\nFile Opened,Now Writting Contents "+args[0]);
f2.write(b);
f2.flush();
System.out.println("\nContent Written..");
System.out.println("\nFile Closing..");
f2.close();
}
}
No comments:
Post a Comment