Page 1 of 1
About Question com.enthuware.ets.scjp.v6.2.338 :
Posted: Sat Mar 01, 2014 4:13 am
by aruna1982
A break statement with no label attempts to transfer control to the innermost enclosing switch, while, do, or for statement; this statement, which is called the break target, then immediately completes normally. If no switch, while, do, or for statement encloses the break statement, a compile-time error occurs.
Is this statement true?
break transfers the control to the end of
while,
for or
switch block starting with the break. Isn't?
Re: About Question com.enthuware.ets.scjp.v6.2.338 :
Posted: Sat Mar 01, 2014 4:39 am
by admin
Re: About Question com.enthuware.ets.scjp.v6.2.338 :
Posted: Sat Oct 24, 2020 8:32 am
by Deleted User 6318
If no labelled statement with Identifier as its label contains the continue statement, a compile-time error occurs.
I cannot wrap my mind around this sentence. Is it correct (maybe that's just my lack of English understanding)?
Does it mean the same as "
if there is no statement with the same label as in the continue"?
Re: About Question com.enthuware.ets.scjp.v6.2.338 :
Posted: Sun Oct 25, 2020 5:21 am
by admin
Basically, if you are doing continue or break <some label>; then a statement having that same label should exist otherwise it wouldn't make any sense to break or continue to that statement!