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.
Yes, according to the grammar defined in the Java Language Specification (§14.5), a Block
is a kind of Statement
, specifically it is a StatementWithoutTrailingSubstatement
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With