How to save a string to a .txt file in java -


this question has answer here:

ive finished application , have tested functions , working. 1 part of inputted data supposed saved .txt file. ive placed inside string im bit out of depth in area , have no idea how save drive on pc. appreciated. code on link: http://sharetext.org/fsy2

try this:

public static void main(string args[])throws ioexception {    file file = new file("hello1.txt");   // creates file   file.createnewfile();   // creates filewriter object   filewriter writer = new filewriter(file);    // writes content file   writer.write("this\n is\n an\n example\n");    writer.flush();   writer.close(); } 

read more abut here


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -