Java coding convention about static method

前端 未结 7 629
情深已故
情深已故 2021-02-05 16:24

It is a very simple question, but I think it is a little bit controversial.

When I code Java classes I use the following order.

class Foo {

    // stati         


        
7条回答
  •  孤街浪徒
    2021-02-05 17:08

    It's all a matter of preference, of course...

    Your convention is more consistent with the default ordering in Javadoc (i.e. static and non-static methods mixed together). This is what I normally do, too.

    However, inner classes are often placed at the bottom of a class as they are often 'secondary' or 'helper' classes, and it seems odd to put them before the main meat of the outer class.

提交回复
热议问题