You can also create objects outside any method if you do it as part of the declaration of an instance variable or a class variable. But code which isn't a declaration must be inside some method.
It's not the instantiation that isn't allowed (line 5 :p) but everything else: a declaration with assignment is different than a statement; statements aren't allowed outside methods (and initializers, as they're sort of different).
I'm using Opera which (rightfully!) doesn't ignore the line break directly after the [code] tag. Therefore there is one empty line at the start and the code declaration is at line 6.
(Of course Firefox and IE8 do ignore the line break so I'm a minority here...)