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...
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.
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: