What is the correct structure of classes in java?
<p>I have been coding in java for about a year and a half, and have made some small games and programs that I think turned out very well. The problem is that I am mostly self taught and I most of my code and class structure is not organized or "correctly structured". This didn't matter to me for the smaller things I made, but if I were to take on a larger project I would want to structure it correctly and make it organized.</p>

<p>In a previous mini-RPG game I had</p>

<ul>
<li>Main Class (Main loop + Main method)</li>
<li>Player Class (containing player position and player stats)</li>
<li>Engine Class (containing map and collision detection between player and map</li>
<li>Map Class (containing map data)</li>
</ul>

<p>My <strong>Main</strong> class contained an instance of <strong>Player</strong> and of <strong>Engine</strong>, and <strong>Engine</strong> had an instance of <strong>Map</strong>. The problem is that <strong>Player</strong> then could't tell the <strong>Engine</strong> where it was, and the <strong>Engine</strong> couldn't adjust <strong>Player's</strong> position and stats when something happened on the <strong>Map</strong>. So I ended up having some static variables and methods in both Player and Engine to get them to communicate.</p>

<p>I guess my overall question is is this the correct structure of classes, and is it correct to use static methods and variables here? If not, how would you structure these classes, or would there need to be more or less classes?</p>

<p>My overall objective is to understand how to structure classes in this previous game so I can better structure classes in a bigger project I want to take on.</p>