0

How to take any bumner of arguments form command line and to search in arraylist>

I now do it in with defined number of arguments and take every argument and search, but this is unlcear to me?

Thanks

2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by mehnihma
0

That I understand but how to take all arguments and split them, like arg[0],arg[1] and so on?

1

Well. exactly like that! The parameter is a perfectly ordinary array of Strings that you can access or index just like any other array.
Eg

for (int i = 0; i < arg.length; i++) {
    // do stuff with arg[i]
}

or

for (String s : arg) {
    // do stuff with s
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.