Hi everybody,
I have Eclipse 3.6.0 installed on Window XP. Also there a sample file in C:\ called sample.txt
The file is empty.
Please give a code that opens this particular file and write a short word "Hello".
Thanks!
Printable View
Hi everybody,
I have Eclipse 3.6.0 installed on Window XP. Also there a sample file in C:\ called sample.txt
The file is empty.
Please give a code that opens this particular file and write a short word "Hello".
Thanks!
Googling for Java File Input/Output is a good way to go. May i suggest checking out the forum rules. Announcements - What's Wrong With My Code?
Lesson: Basic I/O (The Java™ Tutorials > Essential Classes)
Chris
An exmaple of opening a file is given on this page Buffered Streams (The Java™ Tutorials > Essential Classes > Basic I/O)
If you wish to program you need to learn to use APIs they are your friend. On that page a few different classes are mentioned, if you take the time to read the API for them, and the documentation example pages for thos classes, you will learn alot and be opening files in no time at all :)
Chris
Can I suggest following some basic tutorials on Java,
You seem to be missing all of the core concepts of programming in Java. I don't wish to be rude, but you do require to study some more before we can provide a sensible level of hope.
Regards,
Chris