In this, part two of this ten part series on Java, Chris looks at the Java language syntax, variable declerations, truth conditions, loops and more. He finishes by wrapping everything up into a simple Java function.
Java Part 2: Syntax - Making code more readable (Page 3 of 8 )
Java allows the developer to surround statements with parenthesis, ( and ). These are not always necessary for a correct compilation but they can enhance readability of your code and reduce the number of logic errors resulting from the evaluation of statements due to the precedence of operators.
Operator precedence is the same as in standard maths: Brackets, divide, multiplication, addition and then subtraction.
( 3 + 4 ) * 5 is not the same as 3 + 4 * 5.
Also, code indentation should be used to make your code more readable. Code indentation simply involves using the tab key to add white space to the left of each individual line of code. I will describe code indentation in further details as the need arises.