You can not have a non-static method in Main, because there is no instance of the Main class (unless you create one).
The game-loop can be placed wherever you feel is a good place for it. There is no "right" or "wrong" way to do this. Only the way which is right or wrong for you and your current project. However, there are best practices which happen to be right more often than others.
A common technique is to put the game loop method into an own class named Game
or similar and create a new Game
in the main-method. An advantage of this architecture is that you can have multiple Game
s which exist independent of each other.
You might also consider moving your update
-method into a GameState
class and your render-method into a Renderer
class and pass the gamestate to it (renderer.render(gameState);
). This allows you to reuse both components. You could reuse your graphic engine for an entirely different game by passing a GameState object with a different internal logic to it or you could replace your renderer with a different graphic engine. This would, for example, allow you to switch from a 2d engine to a 3d engine without having to change anything at the implementation of your game mechanics. You could also have different renderers for different views of the game state. A minimap, for example, could also be a different renderer. It also visualizes the current gamestate, just in a different way.