| Part of Class/Interface Declaration | Notes | |
|---|---|---|
| 1 | Class/interface documentation comment (/**...*/) |
See "Documentation Comments" on page 9 for information on what should be in this comment. |
| 2 |
class or interface statement |
|
| 3 | Class/interface implementation comment (/*...*/), if necessary |
This comment should contain any class-wide or interface-wide information that wasn't appropriate for the class/interface documentation comment. |
| 4 | Class (static) variables |
First the public class variables, then the protected, then package level (no access modifier), and then the private. |
| 5 | Instance variables | First public, then protected, then package level (no access modifier), and then private. |
| 6 | Constructors | |
| 7 | 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. |
相关文章: