if " for (String s:args) " for loop is used and no values passed at command line for args.
the loop is not getting executed & also it does not throw any exceptions???Why???
sreekanth kulkarni wrote:Could not understand how " for (String s:args) " would be read...
is it similar to assigning value to variable s i,e s=args;
if so where is size declaration for args... this seems to be silly but just wanted to understand the syntax: for (String s:args)
I'm not quite sure what you're having trouble with. The construct is called a "for-each" loop, and was introduced in version 5 for doing precisely what you see without the need for indexes.
As to size declarations: why would you need one? The array (args) already has a size.
Perhaps you could elaborate on exactly what it is you don't understand.