File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Leonidas Savvides
Ranch Hand
Posts: 403
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
running on Eclipse(Java perspective) got:

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


 
Joanne Neal
Rancher
Pie
Posts: 3742
16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Leonidas Savvides
Ranch Hand
Posts: 403
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you MEAN USE

String[list.size()] stg1;
 
Leonidas Savvides
Ranch Hand
Posts: 403
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String[] stg1=new String[list.size()];

success, thks
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic