I need to know what this line of code means: for(String fn : files) System.out.println("found " + fn);
Could you please tell me what the "fn" function is for and why it is being used in this line of code?
Thank you very much
God Bless
Anonymous2012-09-20T05:48:40Z
Favorite Answer
What is happening here is its taking all the variables in 'files' and putting them through a loop. Each loop iteration it puts the current element of files into 'fn' so 'fn' can be called to do something with it. This is how the new c++ 'for each' loops work. If you want more information look up for each loops in something like c#
fn is not a function, it's a variable that is being used to step thru a collection of strings named files. The code can be thought of as "Get each string from collection files sequentially, naming each occurrence fn and print it out."