Page 793 - Introduction to Programming with Java: A Problem Solving Approach
P. 793
APPENDIX 5
Java Coding-Style Conventions
This appendix describes Java coding-style conventions. Most of these guidelines are widely accepted. How- ever, alternative guidelines do exist in certain areas. The coding conventions presented in this document are for the most part a simplified subset of the coding conventions presented on Sun’s Java Code Conventions Web page:
http://java.sun.com/docs/codeconv/
If you have a style question that is not addressed in this document, refer to Sun’s Web page.
While reading the following sections, refer to the example program in the last section. You can mimic
the style in that example.
Prologue
Apago PDF Enhancer
1. Put this prologue section at the top of the file: /***********************************************
* <filename>
* <programmer's name>
*
* <file description>
***********************************************/
2. Include a blank line below the prologue section. Section Delimiting
1. After state variable definitions and between constructor and method definitions, enter a line of stars, like this:
//***********************************************************
Leave a blank line above and below this line of stars.
2. Within a large constructor or method, insert blank lines between logical sections of code. For example, unless the loops are small and intimately related, enter a blank line between the end of one loop and the beginning of another loop.
759