0
Java static method or main method
Should i create a static method or put all the code inside the main method (for example, comparison of instances)
2 Respostas
+ 2
Depends on the size and function. Something over what fits on your screen, if there are functional areas that can be split, do so. Do not break up a function no matter how big it might be.
0
The point of using functions, is code reusability, and separation of concerns. Try to isolate parts of your code that have a single meaningful purpose, in a function. Also if you have to do some action or calculation repeatedly, it makes sense to refactor that part into a method, so that you don't have to repeat the same code in multiple places. This makes it easier to change (or fix) your program in the future, because you only need to change in one place.