Results 1 to 2 of 2
Thread: Java IO Problem
- 03-06-2011, 12:30 PM #1
Member
- Join Date
- Feb 2011
- Posts
- 9
- Rep Power
- 0
Java IO Problem
Excuse me,
I have a problem about the text file to store into array.
I have a text file. It store three columns, Artist, Album and Tracks.
I need to store these data data into array and perform the sorting..
like this
How can I store the text file into array?Java Code:Artist Album Tracks Peter Peter Album 13 John John Album 14 Mary Mary Album 13
And then, How can perform the sorting after store into array?Last edited by Fubarable; 03-06-2011 at 03:28 PM.
- 03-06-2011, 03:09 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Create an object with those three things as fileds, read the file line for line with a BufferedReader and populate these objects adding them to a list. Make sure the class implements Comparable and has a compareTo method, then sort the list using the Collections class and call toArray on the list (or call toArray on the List and sort the array using the Arrays class)..
Similar Threads
-
Need Help!:( Java problem
By ra21 in forum New To JavaReplies: 2Last Post: 02-01-2011, 10:41 PM -
Problem Display Jmenubar Java Se6 u23 versus Java SE6 u22
By Ravanelly in forum Advanced JavaReplies: 0Last Post: 01-07-2011, 09:36 AM -
Problem with Java...
By mc6415 in forum New To JavaReplies: 10Last Post: 02-22-2010, 12:24 AM -
java problem
By Mj Shine in forum New To JavaReplies: 5Last Post: 08-15-2009, 05:09 AM -
Help, java problem
By Suriman in forum New To JavaReplies: 4Last Post: 03-09-2009, 04:26 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks