There seems to be two accepted variable declaration placements for Java variables, each with different raison d'être.
From the Sun's code conventions we can see:
Put declarations only at the beginning of blocks. (A block is any code surrounded by curly braces "{" and "}".) Don't wait to declare variables until their first use; it can confuse the unwary programmer and hamper code portability within the scope.
However in the highly praised "Code Complete" and some other authors advocate for reducing the scope of a variable to a minimum. That is basically waiting to declare variables until their first use.
These two approaches are clearly contradictory although I can see the point for both of them.
Which should I follow? Is there any consensus on the matter?