ouch
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Dishi Jain wrote: void go(int ouch) { ouch++; for (int ouch = 3; ouch < 6; ouch++) ; System.out.print(" " + ouch); } On line no 4. "duplicate local variables" compilation error comes. please help me understand why? Because as per my knowledge, the ouch variable in for loop has it's scope limited to for loop. can it not supersede the method parameter ouch here? The way method parameters will supersede member variables?
Dishi Jain wrote: void go(int ouch) { ouch++; for (int ouch = 3; ouch < 6; ouch++) ; System.out.print(" " + ouch); } On line no 4. "duplicate local variables" compilation error comes. please help me understand why? Because as per my knowledge, the ouch variable in for loop has it's scope limited to for loop. can it not supersede the method parameter