• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Arrays and objects....

 
Kate ryan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic