prepare a set of arguments that can pass to a function in java -


this question has answer here:

i want call function private void passstrings(string... arg){} , have array store set of strings don't know size. how can use array value , call function passstring().

just pass as array:

string[] array = { "some", "arguments", "i", "prepared", "earlier" }; passstrings(array); 

a varargs parameter arg still array parameter - it's compiler allows specify elements individually, if want. doesn't force though - if you've got array, pass it.


Comments

Popular posts from this blog

The SDK directory does not exist (ubuntu 16.04) (react native) -

python - How to clone or copy a list? -

python - How to use Celery in Tornado with redis as broker and backend? -