Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java - array string index

807588Jul 25 2009 — edited Jul 27 2009
hi, im new to java.

regarding string array, is there a way to do string index.??
example:
String[] arr = null;

arr["name"]="myname";

arr["age"]="myage";

arr["gender"]="mygender";
The reason to my question is because im creating a class user. the variables will be private. i would need to get and set these variables, therefore creating a set of get() and set() function for each variable. If i can do the above method, i would simply need one set of get() and set() function where i can pass in parameters.

hope thats not too confusing.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 24 2009
Added on Jul 25 2009
12 comments
561 views