Informatica

Solo disponible en BuenasTareas
  • Páginas : 19 (4728 palabras )
  • Descarga(s) : 0
  • Publicado : 2 de marzo de 2012
Leer documento completo
Vista previa del texto
Java Code Conventions
September 12, 1997

Copyright Information  1997, Sun Microsystems, Inc. All rights reserved. 2550 Garcia Avenue, Mountain View, California 94043-1100 U.S.A. This document is protected by copyright. No part of this document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. The information described in thisdocument may be protected by one or more U.S. patents, foreign patents, or pending applications.

TRADEMARKS Sun, Sun Microsystems, Sun Microelectronics, the Sun Logo, SunXTL, JavaSoft, JavaOS, the JavaSoft Logo, Java, HotJava Views, HotJJavaChips, picoJava, microJava, UltraJava, JDBC, the Java Cup and Steam Logo, “Write Once, Run Anywhere” and Solaris are trademarks or registered trademarks ofSun Microsystems, Inc. in the United States and other countries. UNIX ® is a registered trademark in the United States and other countries, exclusively licensed through X/Open Company, Ltd. Adobe ® is a registered trademark of Adobe Systems, Inc. Netscape Navigator™ is a trademark of Netscape Communications Corporation. All other product names mentioned herein are the trademarks of their respectiveowners.

THIS DOCUMENT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THIS DOCUMENT COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BE INCORPORATEDIN NEW EDITIONS OF THE DOCUMENT. SUN MICROSYSTEMS, INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS DOCUMENT AT ANY TIME.

Please Recycle

ii

June 2, 1997

1

Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 1.2 Why Have Code Conventions. . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . 1 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2

File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2.1 2.2 File Suffixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Common File Names . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

3

File Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.1 Java Source Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1 Beginning Comments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.2Package and Import Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.3 Class and Interface Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3 3 3

4

Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.1 4.2 Line Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . 4 Wrapping Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

5

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Documentation Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
tracking img