Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Java tutorial - (advanced) Creating/writing files in java

Loading...

Sign in or sign up now!
10,512
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Feb 27, 2009

http://users.telenet.be/UMakeIT/
This link leads to my website, there you'll find extra information, downloadable .java files...

In this tutorial I'll show you how to create/write files with java in eclipse

Category:

Howto & Style

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (12SamP12)

  • to add a " you should use \"

  • how to give the path of a file instead of just the file

  • For example: if you want to write a file on your desktop:

    File someFile = new File("C:\Users\-username-\Desk­top");

see all

All Comments (14)

Sign In or Sign Up now to post a comment!
  • If writing and reading files is advanced...

  • @12SamP12 Isn't it File someFile = new File("C:\\Users\\-username-\\D­esk­top");

    "\\" 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();

Loading...

0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more