首页 > 编程语言 > 详细

Java 修饰符顺序 the sequential order of the modifiers

时间:2021-07-07 12:42:45      阅读:20      评论:0      收藏:0      [点我收藏+]

  

 

The Java Language Specification recommends listing modifiers in the following order:

1. Annotations

2. public

3. protected

4. private

5. abstract

6. static

7. final

8. transient

9. volatile

10. synchronized

11. native

12. strictfp

Not following this convention has no technical impact, but will reduce the code‘s readability because most developers are used to the standard order.

Noncompliant Code Example
static public void main(String[] args) { // Noncompliant
}
Compliant Solution
public static void main(String[] args) { // Compliant
}
————————————————
版权声明:本文为CSDN博主「Mr_YDK」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ydk888888/article/details/80288930

Java 修饰符顺序 the sequential order of the modifiers

原文:https://www.cnblogs.com/dissipate/p/14980353.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!