Can't write into a .txt file in netbeans -


i have file called save.txt. in same package class k. problem can't write in .txt file using following code inside k:

file savebutton = new file ("save.txt"); bufferedwriter output = new bufferedwriter (new filewriter (savebutton)); output.write("something"); output.close(); 

can me this?

bw = new bufferedwriter(new filewriter("filepath",true)); bw.write("hello world!"); bw.write("\n"); bw.write("hello world 2 !\n"); bw.write("hello world 3 !" + "\n"); bw.close(); 

try this?

did try easy this:

filewriter f = new filewriter("test.txt"); f.write("hello"); f.close(); 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

c++ - Accessing inactive union member and undefined behavior? -

php - Get uncommon values from two or more arrays -