Java: how do I point at an array item through a variable? -


how point @ array item through variable? example:

string[] names;  int test = 10;  string myname = names[test]; 

the purpose same number item 2 different arrays, username/password program.

in example:

string[] names; int test = 10; string myname = names[test]; 

the variable myname reference string in array, giving new value:

myname = "fred"; 

will nothing array - you'd doing assigning new reference variable.

to give array element bew value, this:

names[test] = "fred"; 

Comments

Popular posts from this blog

Line ending issue with Mercurial or Visual Studio -

java - Jtable duplicate Rows -

java - Run a .jar on Heroku -