1.16 Syntax and Style
Blocks of code, whether classes, methods, or loops, are enclosed in curly brackets:
Every line of code that does not end with a curly bracket is completed with a semi-colon:
Comments can be added by using the following notations:
(two slashes) place a comment until the end of the line
(slash asterisk ... asterisk slash) places a multi-line comment
The style in which code is written depends very much on the individual developer. Here are a few guidelines that are well-adopted for Java programming:
- Vriable names should start with a lowercase letter, and every word afterwards should be capitalized, e.g.
- Classnames should have capitalized words, e.g.
- Instantiated Objects should follow a similar notation to variables, e.g.
- Do not use excessively detailed wording, e.g.
. Glancing over the existing Java objects should give a good idea of what's too lengthy.