aspose file tools*
The moose likes Beginning Java and the fly likes JOptionPane and ArraySize not known Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JOptionPane and ArraySize not known" Watch "JOptionPane and ArraySize not known" New topic
Author

JOptionPane and ArraySize not known

Maureen Charlton
Ranch Hand

Joined: Oct 04, 2004
Posts: 218
If I was to use JOptionPane to get user input, with the opportunity to type exit when the user has finished entering their data, And I wanted to store the data they had input in an array would I have to use a dynamic array? (As I would need the array to grow in size to accommodate the number of user input items to initialise the size of the array).

Or is their an alternative?

Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
If you want to implement this yourself, it looks like you are on the right track. In that case, you don't need "import java.util.ArrayList". Alternatively, you can use ArrayList which already does this magic for you without any effort on your part.

Layne


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JOptionPane and ArraySize not known