I am working with an array and need some help. I would like to create an array where the first field is a String type and the second field is an Integer type.
For result:
Console out
a 1
b 2
c 3
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
An array can only have a single type.
You can create a new class like:
You might also be interested in using a map (it seems to me like you’re trying to map strings to ids).
EDIT:
You could also define your array of type Object but that’s something i’d usually avoid.