Java tutorial - (advanced) Creating/writing files in java
Uploader Comments (12SamP12)
All Comments (14)
-
If writing and reading files is advanced...
-
@12SamP12 Isn't it File someFile = new File("C:\\Users\\-username-\\D
esktop"); "\\" means "\" because just a "\" can represent things like line breaks etc.
-
You know you're a geek when this gets you excited!
Please continue making tutorials, they are great! Just wish you would talk instead of typing instructions :)
-
this is not advanced
-
This tutorial is very useful, thank you
-
File writing is not advanced Java..
-
no sound???
-
You probably have to. I know the scanner needs an import.
-
do i have to import any thing for this java file
-
Thanks, it works. I noticed there are multiple ways to do this. Which one is the best. Example:
PrintWriter out = new PrintWriter("test.txt");
out.println("Bla bla bla");
out.close();
FileReader reader = new FileReader("test.txt");
// if file doesn't exist it creates a file
Scanner in = new Scanner(reader);
if (in.nextLine() etc...) {// do this}
in.close();
to add a " you should use \"
12SamP12 2 years ago
how to give the path of a file instead of just the file
rockykris 2 years ago
For example: if you want to write a file on your desktop:
File someFile = new File("C:\Users\-username-\Desktop");
12SamP12 2 years ago