Answer the question
In order to leave comments, you need to log in
How to choose the order of methods in a class?
Question for Java programmers who work in companies where there is a code-review.
In what order do you keep the methods in the class code? Different ideas come to mind:
1. In order of implementation - I'm writing my first program
2. In alphabetical order - at least some order
3. Publics are ahead - because they will be used later
4. Getters / setters at the end - let them vegetate there
5. The constructor and main are in front - they are the main ones.
6. The order is not important.
Answer the question
In order to leave comments, you need to log in
field
constants ,
set/get
constructors
, and so on
. I think you can do any order, the order is made for readability of the code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question