Reputation: 49
This could apply to other languages but asking specific to Java. In Java would a block itself be a statement? In the Java tutorials: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/expressions.html a block is treated separately from a statement by saying it is a sequence/group of statements but does not say it is a statement itself. Can someone please also explain why.
Upvotes: 4
Views: 108
Reputation: 102902
See JLS §14.5 (see other answer). Also, in both ecj and javac (the two most popular java parsers/compilers out there):
Statement
.So, the spec says it is a statement, and both major implementations represent it as a subtype of its version of Statement.
Upvotes: 2