• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String arrays

 
scott morrison
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
need help with this bigtime, im trying to make a string array that will prompt the user for 5 names but i just cant get it working:
Any help is much appreciated

String[] Names;
Names = new String[5];

for (int i=0; i<5; i=i+1);
{
Names[i] = GUI.getString("enter names");
i = i + 1;
}
 
Leslie Viviani
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the most obvious problems I see is that you are incrementing your counter twice. The following is a more common format for checking the length of the array as well:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic