File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes List to String error got running on Eclipse(Java perspective) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "List to String error got running on Eclipse(Java perspective) " Watch "List to String error got running on Eclipse(Java perspective) " New topic
Author

List to String error got running on Eclipse(Java perspective)

Leonidas Savvides
Ranch Hand

Joined: Jan 31, 2010
Posts: 403
running on Eclipse(Java perspective) got:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at ListToString.main(ListToString.java:32)


Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3495
    
  13
On line 5 you declare stg1 as a zero length array.
On line 22 you try and put something into the first element of that array.


Joanne
Leonidas Savvides
Ranch Hand

Joined: Jan 31, 2010
Posts: 403
you MEAN USE

String[list.size()] stg1;
Leonidas Savvides
Ranch Hand

Joined: Jan 31, 2010
Posts: 403
String[] stg1=new String[list.size()];

success, thks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: List to String error got running on Eclipse(Java perspective)