1 / 3

Java Style

Java Style. Variables: Variable names start with lower case character and separate words by raising the first letter of successive words, e.g. line, audioSystem. Names for constants use all capital letters and underscore “_” to separate words, e.g., MAX_ITERATIONS.

jill
Download Presentation

Java Style

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java Style • Variables: • Variable names start with lower case character and separate words by raising the first letter of successive words, e.g. line, audioSystem. • Names for constants use all capital letters and underscore “_” to separate words, e.g., MAX_ITERATIONS. • Variables with larger scope use longer names and otherwise use shorter names. • Boolean variables has the format isX, e.g., isVisible, isSet. • Abbreviations of words should be avoided. • Avoid using magic numbers; define constants instead. • Variables should be declared where they are used and localized in a small scope.

  2. Java Style • Layouts: • Use indentation to increase clarity. • Put white spaces around operators and colons; put one white space after key words and commas; • Insert blank rows between logic statement blocks. • While statements use the following two styles: while (condition) { statements; } while (condition) { statements; } or if (condition) { statements; } else if (condition) { statements; } else { statements; } 6. If statements 5. Do-while Statements do { statements; } while (condition);

  3. Java Style 7. Do-while Statements for (initialization; condition; update) { statements; }

More Related