Results 1 to 2 of 2
- 11-20-2011, 12:23 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 5
- Rep Power
- 0
read from text file into array of objects
Hi - can anyone share a simple example of how to read from a text file into an array of objects?
text file example:
Part ID: MOV001, Part No: PG, Description: Wheel
Part ID: MOV234, Party No: G, Description: Tyre
I wish to write this details into an array of part objects
Parts [] part = new Parts [10];
start of code:
BufferedReader bufr = new BufferedReader(new FileReader ("part.txt"));
Unsure how to go from here?
- 11-20-2011, 12:40 PM #2
Member
- Join Date
- Oct 2011
- Posts
- 15
- Rep Power
- 0
Re: read from text file into array of objects
If you already have your Parts class, you just need to read your data from the text file.
Here are some tutorials on how to do that:
Dystopian Code: Text File I/O in Java
Dystopian Code: Text File I/O with Strings that Contain Spaces in Java
Similar Threads
-
how to read a text delimited file using 2 dimentional array in java ??
By pooja123 in forum New To JavaReplies: 2Last Post: 04-01-2011, 03:04 PM -
Read a data from a text file and create an object from these data in this text file
By jjavaa in forum Advanced JavaReplies: 2Last Post: 03-25-2011, 02:36 PM -
Read text file into array instead of being hard coded in the script.
By biirdo in forum New To JavaReplies: 7Last Post: 11-01-2010, 02:04 PM -
read txt file,with some records, create objects and store objects in tables of a db.
By stamv in forum JDBCReplies: 1Last Post: 01-22-2009, 04:25 PM -
How to read a text file from a Java Archive File
By Java Tip in forum Java TipReplies: 0Last Post: 02-08-2008, 09:13 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks