| Author |
text data files
|
Nazma Panjwani
Greenhorn
Joined: Jan 17, 2010
Posts: 14
|
|
Hi Guys,
I am trying to create a text data file, file extension .dat.....how do I do this??
Basically, I am supposed to write a class in java, that reads from this text file, (the text file contains inventory information such as item name, # of units, price etc), and creates objects (of some class type which I am also supposed to create). So, taht's two classes........
Can I create a wordpad file, and change the extension to .dat???
Thanks
Nazma
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
Can I create a wordpad file, and change the extension to .dat???
Any editor will do, as long as you save it as a text file, and give it a .dat extension. You can even save it as a .txt file, and rename it after, using for example windows explorer.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
|
|
|
Why are you supposed to give it a .dat extension? If you do that, Windows will think it is a system file.
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
Why are you supposed to give it a .dat extension?
I remember sometimes data files in old games were using that extension. They were binary files though.
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
|
If you want to learn about reading and writing files in Java, then have a look at Lesson: Basic I/O in Sun's Java tutorials. Especially the page Character Streams from that tutorial shows with examples how you can read and write text files.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: text data files
|
|
|