File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes String Array without knowing dimensions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "String Array without knowing dimensions" Watch "String Array without knowing dimensions" New topic

String Array without knowing dimensions

Anjanesh Lekshminarayanan
Ranch Hand

Joined: Oct 21, 2003
Posts: 46
Anyway to accomplish this with setting the size of the array and without the use of java.util.Arrays ?
I need the get the lines of a file in an array (of n number of lines)
Neither do I want to repeat the entire loop of reading the file to figure out the number of lines.

Actually Im used to PHP and this would normally work in PHP.

Anjanesh Lekshminarayanan
Yosi Hendarsjah
Ranch Hand

Joined: Oct 02, 2003
Posts: 166
Hi Anjanesh,
You can use classes that implement List interface, like ArrayList or Vector.

subject: String Array without knowing dimensions
It's not a secret anymore!