• 首页
  • 前端技术
  • 编程语言
  • 人工智能
  • 运维知识
  • 资源下载
  • 常用小工具
  • 技术问答

Java语言编码规范【Sun官方标准】

2021-05-19

原文:Code Conventions for the Java Pogramming Language

译文:Java语言编码规范 @Author:晨光(Morning)

Code Conventions for the Java Programming Language


1 Introduction

1.1 Why Have Code Conventions
1.2 Acknowledgments

2 File Names

2.1 File Suffixes

2.2 Common File Names

3 File Organization

3.1 Java Source Files
3.1.1 Beginning Comments
3.1.2 Package and Import Statements
3.1.3 Class and Interface Declarations

4 Indentation
4.1 Line Length
4.2 Wrapping Lines

5 Comments
5.1 Implementation Comment Formats
5.1.1 Block Comments
5.1.2 Single-Line Comments
5.1.3 Trailing Comments
5.1.4 End-Of-Line Comments
5.2 Documentation Comments

6 Declarations
6.1 Number Per Line
6.2 Initialization
6.3 Placement
6.4 Class and Interface Declarations

7 Statements
7.1 Simple Statements
7.2 Compound Statements
7.3 return Statements
7.4 if, if-else, if else-if else Statements
7.5 for Statements
7.6 while Statements
7.7 do-while Statements
7.8 switch Statements
7.9 try-catch Statements

8 White Space
8.1 Blank Lines
8.2 Blank Spaces

9 Naming Conventions

10 Programming Practices

10.1 Providing Access to Instance and Class Variables
10.2 Referring to Class Variables and Methods
10.3 Constants
10.4 Variable Assignments
10.5 Miscellaneous Practices
10.5.1 Parentheses
10.5.2 Returning Values
10.5.3 Expressions before `?' in the Conditional Operator
10.5.4 Special Comments

11 Code Examples
11.1 Java Source File Example

相关文章:

猜你喜欢
相关资源
相似解决方案
热门标签
Java Python linux javascript Mysql C# Docker 算法 前端 SpringBoot Redis Vue spring 设计模式 .net core .net kubernetes c++ 数据库 数据结构 大数据 js 机器学习 微服务 Android Go 程序员 面试 JVM ASP.net core 云原生 人工智能 后端 PHP git CSS golang k8s Nginx Django mybatis 深度学习 多线程 React 架构 devops 爬虫 云计算 Spring Boot LeetCode
By © 2026 likecs 版权所有,
本站所有数据收集于网络如有侵犯到您的权益请联系 进行下架处理1。
粤ICP备22038628号Powered By WordPress