Edit: I've voted to reopen the question; it's perfectly valid, there are actual important difference between the two approaches, and if two different programs that had the same behaviour at runtime are considered equivalent, then there's no need to learn about methods/functions, generics/templates, classes, or anything else that exists largely to help you structure a program to make it more maintainable.
To advise the original poster to stop thinking carefully about this, and just get on with churning out code, is very bad advice.
Declaring all variables at the start of a function is a habit left over from C, where it was required by the compiler.
It's far better to declare and initialize at the same time; the namespace of variables shouldn't be poluted with things that aren't needed yet, and which haven't been initialized yet.
The key point is degrees of freedom, which in this context is the number of ways in which something can go wrong. The gap between declaration:
MyClass myRef;
and initialization:
myRef = new MyClass();
is a region in which myRef is presumably not being used in the current version of the software, but where it has the value null. It's like a loose end that has been left dangling on the floor to trip people up.
There's a connection between those two lines of code; they make no sense unless they happen in that order, one after the other - imagine them connected by a piece of cable. So why stretch them apart and put them on opposite sides of the room?
Eventually your code will end up like this.
Update: It's been suggested this isn't significant because it has no effect on the functionality of the software - it's purely a matter of style, like where you put the curly-braces.
It's seriously nothing like that. Here's a fictional suggestion that would have no effect on the functionality of many programs:
TIP: put all the code for your whole
program into a single giant class,
with hundreds or even thousands of
fields and methods. This way, you save
a lot of pointless effort declaring
many separate classes - not to mention
the effort of thinking of names for
the classes. Make sure the fields are
all private, because that's important
for encapsulation!
Does anyone really think we shouldn't critique a suggestion like that, just because it doesn't affect the functionality of a program? This question is about a small-scale, but no less important, version of the same problem.