About Question enthuware.ocajp.i.v8.2.1193 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
RalucaD
Posts: 3
Joined: Mon Jan 18, 2016 3:17 pm
Contact:

About Question enthuware.ocajp.i.v8.2.1193 :

Post by RalucaD »

The explanation says:
It is not possible to break out of an if statement. But if the if statement is placed within a switch statement or a loop construct, the usage of break in option 3 would be valid.
But what about break with label?

Code: Select all

public class Q33{
	public static void main(String[] args){
		label: if(true){
			System.out.println("break label");
			break label;
		}
	}
}

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

Re: About Question enthuware.ocajp.i.v8.2.1193 :

Post by admin »

break with a label is possible. This has now been added to the explanation.
thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests