Java Tutorial 24 - FileWriter

preview_player
Показать описание
After watching this, you'll know how to create a text from Java to the text file.
Рекомендации по теме
Комментарии
Автор

I understand this so much better than the average Java GUI tutorial, thanks

MTRG
Автор

Thanks a bunch ^^, helped out alot. One question though, I don't know if you cover this question in another video but, when I write something in the file(not through eclypse) and then write something in the program, (.java) what I wrote directly in the file is deleted, how could I add, instead of write over?

iLuvHinata
Автор

how do you replace 2nd line data of a file to something new. i have milisecond time in 2nd line of a file and want to replace to new updated long miliseconds type time? please show me how

mh
Автор

Why is the for loop i used for your op.witer() not working?


package Main;

import java.io.*;
import java.util.*;


public class Main {

static List<String> names = new ArrayList<String>();
static String fileName = "default";


public static void main( String[] args ) throws IOException{
   
names.add("Hallo");
names.add("Welt");

File save;
save = new File(fileName + ".txt");

if (!save.exists()){
save.createNewFile();
System.out.println("New");
}

FileWriter saver = new FileWriter(save);
BufferedWriter out = new BufferedWriter(saver);

for (int i = 0; i > names.size(); i++){
out.write(names.get(i));
out.newLine();
System.out.println(i);
}
out.close();
}
}

KaidoLP
Автор

You are not very clear at explaining it.

oscargracias