In Java, what's generally the most accepted way to organize a class in terms of the order in which declared data members and methods should be listed in the class file, keeping in mind the following and anything else you can think of for each one:
I've found that the conventions in Code Conventions for the JavaTM Programming Language to be quite suitable. Chapter 3 answers this question.
Mostly it ignores visibility or whether it is an overloaded function etc.
It is simply in order:
A more rigorous approach could be taken, but I do not see a strong argument in its favor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With