|
Insane Totoro posted:Well I thought I might just be able to iterate through the .txt file and create an array based on the length of that .txt file. However the .txt file does not always have a consistent number of words. How can I declare an array if I don't know how long the array needs to be? And given the way I must name the method, it seems I cannot even return an array from the method. This seems very confusing to me and I am at a loss as to what I should be doing. I suppose I could write my own method that lets me return something but that seems to violate the "terms" of the assignment. Depending on whether this also violates the terms of the assignment or not, consider using an ArrayList. It's essentially an array that grows as you add to it; since you don't know the size of the array in advance it seems like it would be a good fit. About not being able to return an array from the method: if you declare/initialize the array outside of the method, you can modify it. That is, if you do something like: code:
|
# ¿ Feb 3, 2013 04:34 |
|
|
# ¿ May 20, 2024 00:34 |