• Post Reply Bookmark Topic Watch Topic
  • New Topic

Arrays  RSS feed

 
Joshua Perrine
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to use arrays to declare name/address and to populate it


 
Carey Brown
Saloon Keeper
Posts: 3308
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see an array declared anywhere (?). Do you know how to declare an array?

Also, when you post code you need to enclose it in "Code" tags. Above the edit window are some buttons, one of which is Code. First highlight your code, then click that button.
 
Joshua Perrine
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know how to declare an array confused on how to here
 
Carey Brown
Saloon Keeper
Posts: 3308
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To declare an array of int's
The first "[]" says we are declaring an array, and the "[ 10 ]" allocates room for 10 int's'.

You have
You could make each one an array but you'd be asking for trouble trying to keep them in sync.
The best approach is to define a class (e.g.) Person with those fields. and then allocate one array of Person objects.
 
Joshua Perrine
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still confused on how to implement this into my code.
 
Carey Brown
Saloon Keeper
Posts: 3308
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you Google "java array tutorial" and study some of those. This TUTORIAL looked good. I also suggest writing some very small programs to practice, put your current project aside for now.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!