It basically waits for variable declarations before their first use.
This is actually not the case, and the two styles do not contradict each other. Limiting the scope of a variable means that this variable does not, in fact, exist outside this scope. For example.
for(int i=0; i<10;i++){ int a = 5; doSomething(a); }
In this case, a is the scope limited by the for block, and this is what refers to the code.
In any case, I agree with the sun that variables within the scope (class, method, if block, etc.) should be declared at the beginning.
jpredham
source share