About Question com.enthuware.ets.scjp.v6.2.338 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
aruna1982
Posts: 5
Joined: Sat Feb 15, 2014 4:31 pm
Location: Singapore
Contact:

About Question com.enthuware.ets.scjp.v6.2.338 :

Post 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?

admin
Site Admin
Posts: 10053
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.338 :

Post by admin »

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.

noeloo
Posts: 61
Joined: Sat Feb 15, 2020 8:56 am
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.338 :

Post by noeloo »

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"?

admin
Site Admin
Posts: 10053
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.338 :

Post 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!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests