| Author |
Question on varargs
|
victor kamat
Ranch Hand
Joined: Jan 10, 2007
Posts: 247
|
|
Consider the following code: This code compiles fine and puts out the expected output. What has me confused is the "final" int the second for loop. I would have thought that the code would not compile. If we make k final in the 1st loop, code does not compile. Can somebody explain this to me. [ January 21, 2007: Message edited by: Barry Gaunt ]
|
 |
victor kamat
Ranch Hand
Joined: Jan 10, 2007
Posts: 247
|
|
I have answered my own question. In the loop body cannot change value of i void prt(int... par) { for(final int i : par) { // in loop body cannot change i } } [ January 21, 2007: Message edited by: Barry Gaunt ]
|
 |
 |
|
|
subject: Question on varargs
|
|
|