• Post Reply Bookmark Topic Watch Topic
  • New Topic

read and write a file  RSS feed

 
Ji Li
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a newbie in Java, and have a qustion about reading and writing
a file.

Suppose a file in d:/test.txt (a char file), pls tell me how to read
(input) and write out(output) a file. A simple example is enough.

Thanks all - li

(anybody tells me that this is a correct group I am in for the qustion ?)
[ May 30, 2004: Message edited by: Ji Li ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Ji Li!

Around these parts, we prefer that you make an effort to come up with a solution, and post concerning problems or not-quite-understood concepts that you might come across.

So, post some code that you're working on, and folks around here will be glad to nudge you in the right direction. Note: When posting code, please be sure to surround the code with the [code] and [/code] UBB Tags. This will help to preserve the formatting of the code, thus making it easier to read and understand.

Since we've a forum dedicated to I/O questions, I'm moving this thread there. Please continue in the I/O and Streams forum...
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Li,
For your information, allow me to recommend the following resources:
  • Chapter 12 of Bruce Eckel's book Thinking in Java
  • I/O Lesson of the Java Tutorial
  • Dr. Richard Baldwin's tutorial
  • The Java Developer's Almanac


  • Good Luck,
    Avi.
     
    Ji Li
    Greenhorn
    Posts: 19
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Avi :

    thanks, I will take time reading it

    -- li
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!