Nikhil Sagar wrote:
Kemal Sokolovic wrote:You can't write statements outside methods.
We can write statements outside method, but not all.
Yes, but not the way you're probably thinking.
All statements must be inside a method, a constructor, or an initializer block. If that's what you meant, you're correct. Statements can never go directly inside a class, where the OP put his for loop.