I was setting out to write a piece of code today in Eclipse, and I started out like so:
public class MyClass {
System.currentTimeMillis();
}
Is there some compiler level rule that says that only assignment statements or declarations should be present inside the class body?
In a word: yes. At the class body level you can have instance and static member variable declarations, method declarations, nested classes, object initialization blocks, static initialization blocks, and comments. That's it, by definition.
The "compiler level rules" for a language are called its grammar.