OutputStream os=new FileOutputStream("C:\\myTxt.txt"));
PrintWriter pw=new PrintWriter(os);
pw.println("hello");
pw.println("world");
pw.close();
PrintWriter pw=new PrintWriter(os);
pw.println("hello");
pw.println("world");
pw.close();
public static void main(String [] args){
try{
FileOutputStream fout = new FileOutputStream("c:\\test.txt");
String s = "hello\nworld";
fout.write(s.getBytes());
fout.close();
}catch(Exception e){
}
}
}
File f= new File(pathname);
f.createNewFile();
FileWriter fo=new FileWriter(file);
FileWriter.write("hello");
FileWriter.write("world");
import java.io.*;
file1.SeekToEnd();
file1.Write("hello",strlen("hello"));
file1.Write("\r\n",strlen("\r\n"));
file1.Write("world",strlen("world"));
file1.Close();