Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Joined: Sep 16, 2008
Nov 23, 2008 23:46:00
I have a file named Songs.txt. Now i want to read the data in this file and store it in an
named SongList and sort it,using sort().
I have written the following program,but I am not able to proceed further.Please Help.
public class Song
public static void main(
File file=new File("Songs.txt");
Joined: Feb 19, 2008
Nov 23, 2008 23:59:00
If you are getting a string 'line' , which contains the song name, why don't you make an instance of
'line' into it !!
And the call
() method to sort them !!
It's simple, isn't it ?
[Freelance Web Designer]
[and "Rohan" is part of my surname]
Joined: Mar 22, 2005
Nov 24, 2008 00:07:00
If you haven't used any of the
classes before, you may want to work through the
Tutorial chapter on that:
Joined: Oct 13, 2005
Nov 24, 2008 00:49:00
And please use the
and maintain indentation in quoted code.
I agree. Here's the link:
Creating my First Object
Need to read and write data from file.
Traverse DOS/UNIX diretories - print members
Returning array To Method
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015