Java coding convention about static method

前端 未结 7 752
情深已故
情深已故 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:19

    I believe Sun's (now Oracle's) Java coding standards are more widely used. This is what you are currently using too.

    From Code Conventions for the Java TM Programming Language :

    3.1.3 Class and Interface Declarations

    The following table describes the parts of a class or interface declaration, in the order that they should appear.

    1. Class/interface documentation comment ( /*.../)
    2. class or interface statement
    3. Class/interface implementation comment ( /.../), if necessary
    4. Class (static) variables
    5. Instance variables
    6. Constructors
    7. Methods

提交回复
热议问题