Are there any Java method ordering conventions? [closed]
Solution 1:
Some conventions list all the public methods first, and then all the private ones - that means it's easy to separate the API from the implementation, even when there's no interface involved, if you see what I mean.
Another idea is to group related methods together - this makes it easier to spot seams where you could split your existing large class into several smaller, more targeted ones.
Solution 2:
Class (static) variables: First the public class variables, then the protected, and then the private.
Instance variables: First public, then protected, and then private.
Constructors
Methods: These methods should be grouped by functionality rather than by scope or accessibility. For example, a private class method can be in between two public instance methods. The goal is to make reading and understanding the code easier.
Source: http://www.oracle.com/technetwork/java/codeconventions-141855.html