Win a copy of Functional Reactive Programming this week in the Other Languages 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
  • 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
Posts: 3742
16
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you MEAN USE

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

success, thks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic