Sun官方发布的Java代码规范

本文详细介绍了Java编程语言的代码规范,包括文件命名、注释格式、缩进规则、语句书写等,旨在提高代码的可读性和一致性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[链接] http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

CONTENTS | PREV | NEXT


Code Conventions for the JavaTM Programming Language

Revised April 20, 1999



1
1.1 Why Have Code Conventions 1.2 Acknowledgments Introduction
2 2.1 File Suffixes 2.2 Common File Names File Names
3 3.1 Java Source Files
3.1.1 Beginning Comments
3.1.2 Package and Import Statements
3.1.3 Class and Interface Declarations
File Organization
4 4.1 Line Length 4.2 Wrapping Lines Indentation
5 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 Comments
6 6.1 Number Per Line 6.2 Initialization 6.3 Placement 6.4 Class and Interface Declarations Declarations
7 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 Statements
8 8.1 Blank Lines 8.2 Blank Spaces White Space
9 Naming Conventions
10 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
Programming Practices
11 11.1 Java Source File Example Code Examples
CONTENTS | PREV | NEXT
Copyright © 1995-1999, Sun Microsystems, Inc. All Rights Reserved.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值