Originally posted by Mark Hughes:
I'm not sure if this is why you're getting the compile time error, but I see no reason for the array initializer (the open and closing brace brackets on the second line of code. Since you are not supplying any elements, this is unnecessary, and is the equivalent of this:
This means that you are CREATING a new instance of a String array. But then on line 3, you are calling lines.toArray(); (watch the use of capitals, this is not technically the correct name for the method), which assigns textfile to refer to a completely DIFFERENT array, and LOSING the reference to the original array that you created, so the net effect (other than making the garbage collector work harder) is this:
[/QB]
As far as I can tell, this SHOULD compile, so if this doesn't fix your problem, then your problem is probably in some other line of code that you didn't post here.
- Adam