Java Tutorial for Beginners - 48 - Write to a text file

preview_player
Показать описание
In this tutorial we will write to a text file.
Рекомендации по теме
Комментарии
Автор

Source:

import java.io.FileWriter;
import java.io.IOException;
 
public class TextFile {
public static void main(String[] args) {
            
try {
 
String text = "Text inside the file";
 
FileWriter fw = new FileWriter ("C://test.txt");
fw.write(text);
fw.close();
 
} catch (IOException e) {

}
}
}

EJMedia
Автор

Sorry for bombarding with questions but how come the previous catch was (IOException ioe) while this was just (IOException e)? Whats the difference?

MrAirPork
join shbcf.ru