I think I understand this part: "Some statements contain other statements as part of their structure; such other statements are substatements of the statement."
Source: (second paragraph) http://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html
Please correct me if I'm wrong: This refers to method calls, which contain multiple statements within. This also refers to actions such as performing some kind of operation like calculating or concatting a String while initializing.
What I'm having troubles understand is this: "We say that statement S immediately contains statement U if there is no statement T different from S and U such that S contains T and T contains U"
I'm not gonna lie, they totally lost me here. I can't imagine this in my head, or write it out on paper. The wording has me totally confused.
Can someone please explain this is an easier to understand fashion?
If you have for example
if (Expression1)
while (Expression2)
Statement1
then the IfThenStatement
immediately contains a WhileStatement
. It also contains Statement1
, but it does not immediately contain Statement1
.
Referring to the symbols used in the JLS spec S is the IfThenStatement
which contains the WhileStatement
T, which in turn contains Statement1
U. Therefore S does not immediately contain U.