Statements
- Variable declaration:
int a;
- Value assignment:
a = 33;
- Combined declaration and assignment:
int a = 33;
- Expression:
a - 4
- Statement:
b = a - 4;
Notice the trailing “
;
”.
a = b + 3; b = a - 4;
Discouraged by good coding practices:
-
Poor readability
-
Hampers debugging
double initialAmount = 34;
{ // first block
final double interestRate = 1.2; // 1.2%
System.out.println("Interest:" + initialAmount * interestRate / 100);
}
{ // second block
final double interestRate = 0.8; // 0.8%
System.out.println("Interest:" + initialAmount * interestRate / 100);
}
|
|