Member Avatar for mehnihma

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

You need to loop through the argument array and search for each element in turn.

Member Avatar for mehnihma

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

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
}
Member Avatar for mehnihma

Thanks, I was confued about that...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.