I’m sure there used to be a plugin for this kinda stuff, but now that I need it, I can’t seem to find it (naturally), so I’ll just ask...
In Java, you cannot directly write the executable statements in class. You need to move your code in a method. Only variables declaration is allowed outside the method/blocks. Just...