aspose file tools*
The moose likes Beginning Java and the fly likes Arrays and objects.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Arrays and objects...." Watch "Arrays and objects...." New topic
Author

Arrays and objects....

Kate ryan
Greenhorn

Joined: Dec 08, 2004
Posts: 5
Hey,
I'm trying to write a program which reads in a sequence of lines, containing a name and telephone number and sorts it into an alphabetically ordered telephone directory. I was just wondering if anyone would be able to tell me how I could read in an unlimited amount of input...??
Thanks in advance...
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Well, you can't just read in an unlimited amount of input. There are system and memory limitations depending on what you are running on. What you could do is read in a certain amount, process it, save it, and then get the next chunk.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Instead of using an array, which has to be allocated at a specific, fixed size, you can use a List (for example, java.util.ArrayList) which grows as needed. In JDK 1.5:



[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Arrays and objects....