E
E
EVGENY T.2018-03-21 16:57:50
Java
EVGENY T., 2018-03-21 16:57:50

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

1 answer(s)
P
P_Alexander, 2018-03-21
@Beshere


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 question

Ask a Question

731 491 924 answers to any question