I have an array like of objects in my main
Number[] NumberArray;
The class Item has this definition:
public class Number {
int a1;
int a2;
}
I need to accept input from command line like say 1 2 3 4 5 6, such that
Number[1].a1 = 2
and
Number[1].a2 = 3
and
Number[4].a1 = 5
and
Number[4].a2 = 6.
How do I do this?
Please help.
Number[0], which is the first entry in the array. To that end, when you writepublic static void main(String[] args),argswould hold1 2 3 4 5 6. Have you attempted anything to parse that array in your program? If you did, where are you stuck?