A Java method is a collection of statements. The best way to use methods, is in a grouped way. The reason to use several methods is for yourself and other programmers to make exactly clear how the program is built up, and how it could be changed it. When you use more methods you group them so you can easily find different parts of your program. So, for example if you want to create the game snake in Java. There is one class in which you could create the game itself.

Maybe you will use a few more classes to make the game. But we will treat the making of several classes and even the making of the game snake in a further stage. This can be found on this website.

For a game like snake you have to make a plan for yourself. You have to think about the thinks you want to put in the game. For snake is this for example:

  • control the snake
  • place an apple
  • check the bounderies
  • etc..

This are all different parts of the game, and to keep track of all these different parts it is better to create different methods.