Is this statement true? break transfers the control to the end of while,for or switch block starting with the break. Isn't?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.
About Question com.enthuware.ets.scjp.v6.2.338 :
Moderator: admin
-
- Posts: 5
- Joined: Sat Feb 15, 2014 4:31 pm
- Location: Singapore
- Contact:
About Question com.enthuware.ets.scjp.v6.2.338 :
-
- Site Admin
- Posts: 10053
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.338 :
Yes, this is from JLS. Please see http://docs.oracle.com/javase/specs/jls ... #jls-14.15 for more details.
If you like our products and services, please help us by posting your review here.
-
- Posts: 61
- Joined: Sat Feb 15, 2020 8:56 am
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.338 :
I cannot wrap my mind around this sentence. Is it correct (maybe that's just my lack of English understanding)?If no labelled statement with Identifier as its label contains the continue statement, a compile-time error occurs.
Does it mean the same as "if there is no statement with the same label as in the continue"?
-
- Site Admin
- Posts: 10053
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.338 :
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!
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 31 guests