From the command line i give values of the array:
> java program Hello HelloWorld "Hello World"
I need to count length of each value. I supposed to receive { 5 , 10 , 2 } but my code is couting each separate character in "Hello World" input instead of taking each word as a 1 string. How can I do so?
"Hello Word"
is one string, why do you expect that to be different from the other parameters? If you want to count words you need to split that string into words in your code. Also, why are you supposed to get 5, 10 and 2? 5 and 10 look like the length of the strings, why should"Hello World"
be treated differently?