Added: 2 years ago
From: 12SamP12
Views: 10,514
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:
see all

All Comments (14)

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

  • 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???

  • 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();

  • do i have to import any thing for this java file

  • You probably have to. I know the scanner needs an import.

  • to add a " you should use \"

  • how do I add special characters like " , in the text ? and btw, i tried the ("C:\Users\-username... thing, but it didnt work, i got this error :

    Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )

    thanks a lot in advance

  • Make more tutorials about desktop applications in java!

    That would help me!!!

  • Thank you man

    I really love java

  • 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");

  • @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.

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