TermCommentPost For Break Statement November 30, -00014 Comments1 Min Read You may also like ArrayList Insert all elements of other Collection to Specified Index of Java ArrayList Example December 1, 2011 ZipFile Find File in a Zip File Example December 1, 2011 AWT Button Determine If The Button Is Visible Example December 1, 2011 Long Wrapper Class Convert long primitive to Long object Example December 1, 2011 Vector Add an element at specified index of Java Vector Example December 1, 2011 System Terminate virtual machine using System class December 1, 2011 Final Java Final variable example December 1, 2011 AWT Choice Disable AWT Choice Or Combobox Example December 1, 2011 TreeSet Get lowest and highest value stored in Java TreeSet example December 1, 2011 Vector Sort elements of Java Vector Example December 1, 2011 AWT Color Get Brighter Version Of Current Color Example December 1, 2011 Java String Examples Java ArrayList to String Array Example December 1, 2011 Receive LATEST Java Examples In Your Email Enter your email address below to join 1000+ fellow learners: 4 Comments Cancel reply CommentName * Email * Label is so useful Reply What if it was not labelled. Would it break from the inner loop or from all the loops ? for(int var1=0; var1 < 5 ; var1++){ for(int var2 = 1; var2 < 5; var2++) { System.out.println(“var1:” + var1 + “, var2:” + var2); if(var1 == 3) break ; }} Reply It would break just a current loop (the inner one). Reply if (action.getActionStatus() == ActionStatus.Completed) { boolean bFind = false; String strKey=””; theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] – “+id+” – Alarm ID – ActionStatus.Completed ******!!!!!!!!!!” ); for (Iterator<actionresponseitem> it = action .getListActionResponseItem().iterator(); it.hasNext();) { ActionResponseItem tempResponse = it.next(); List<com.hp.uca.mediation.action.jaxws.actionresponseitem.output.entry> listEntry = tempResponse .getOutput().getEntry(); for (Iterator<com.hp.uca.mediation.action.jaxws.actionresponseitem.output.entry> itEntry = listEntry .iterator(); itEntry.hasNext();) { com.hp.uca.mediation.action.jaxws.ActionResponseItem.Output.Entry entry = itEntry .next(); theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] – “+id+” – Key=” + entry.getKey() + “, value=” + entry.getValue()); strKey = entry.getKey(); if (strKey.equalsIgnoreCase(“EntitySpec”)) { strRet = entry.getValue(); theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] – “+id+” – Alarm ID – ” + strRet); bFind = true; break; } } if (bFind) break; } if(strKey != null) { Flag flag=new Flag(strRet.toLowerCase(), “CIMD_SIA_PROCESS:” , true); theScenario.getSession().insert(flag); } } else{ theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] : Failure – “+id+” – Alarm ID – ” + action.getActionStatus().toString()+ ” : “+ action.getActionStatusExplanation().toString()+” : “+ action.getActionSubStatus().toString()); } how to break 1st if loop Reply Sponsors search example Popular Examples Java String to String Array Example Find Largest and Smallest Number in an Array Example Java String Array Length Example Convert java int to Integer object Example List Even Numbers Java Example Draw Smiley In Applet Example Draw Oval & Circle in Applet Window Example Change Button Background Color Example List Odd Numbers Java Example Copy Elements of One Java ArrayList to Another Java ArrayList Example Facebook Fans Java-Examples.com Recently Commented Examples Java Pyramid 5 Example Declare multiple variables in for loop Example Java Pyramid 6 Example Reverse Number using Java Prime Numbers Java Example Do While loop Example If Else-If statement Example Java Pyramid 1 Example Find Largest and Smallest Number in an Array Example Calculate Circle Area using Java Example
ArrayList Insert all elements of other Collection to Specified Index of Java ArrayList Example December 1, 2011
What if it was not labelled. Would it break from the inner loop or from all the loops ? for(int var1=0; var1 < 5 ; var1++){ for(int var2 = 1; var2 < 5; var2++) { System.out.println(“var1:” + var1 + “, var2:” + var2); if(var1 == 3) break ; }} Reply
if (action.getActionStatus() == ActionStatus.Completed) { boolean bFind = false; String strKey=””; theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] – “+id+” – Alarm ID – ActionStatus.Completed ******!!!!!!!!!!” ); for (Iterator<actionresponseitem> it = action .getListActionResponseItem().iterator(); it.hasNext();) { ActionResponseItem tempResponse = it.next(); List<com.hp.uca.mediation.action.jaxws.actionresponseitem.output.entry> listEntry = tempResponse .getOutput().getEntry(); for (Iterator<com.hp.uca.mediation.action.jaxws.actionresponseitem.output.entry> itEntry = listEntry .iterator(); itEntry.hasNext();) { com.hp.uca.mediation.action.jaxws.ActionResponseItem.Output.Entry entry = itEntry .next(); theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] – “+id+” – Key=” + entry.getKey() + “, value=” + entry.getValue()); strKey = entry.getKey(); if (strKey.equalsIgnoreCase(“EntitySpec”)) { strRet = entry.getValue(); theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] – “+id+” – Alarm ID – ” + strRet); bFind = true; break; } } if (bFind) break; } if(strKey != null) { Flag flag=new Flag(strRet.toLowerCase(), “CIMD_SIA_PROCESS:” , true); theScenario.getSession().insert(flag); } } else{ theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] : Failure – “+id+” – Alarm ID – ” + action.getActionStatus().toString()+ ” : “+ action.getActionStatusExplanation().toString()+” : “+ action.getActionSubStatus().toString()); } how to break 1st if loop Reply
Label is so useful
What if it was not labelled. Would it break from the inner loop or from all the loops ?
for(int var1=0; var1 < 5 ; var1++)
{
for(int var2 = 1; var2 < 5; var2++)
{
System.out.println(“var1:” + var1 + “, var2:” + var2);
if(var1 == 3)
break ;
}
}
It would break just a current loop (the inner one).
if (action.getActionStatus() == ActionStatus.Completed) {
boolean bFind = false;
String strKey=””;
theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] – “+id+” – Alarm ID – ActionStatus.Completed ******!!!!!!!!!!” );
for (Iterator<actionresponseitem> it = action
.getListActionResponseItem().iterator(); it.hasNext();) {
ActionResponseItem tempResponse = it.next();
List<com.hp.uca.mediation.action.jaxws.actionresponseitem.output.entry> listEntry = tempResponse
.getOutput().getEntry();
for (Iterator<com.hp.uca.mediation.action.jaxws.actionresponseitem.output.entry> itEntry = listEntry
.iterator(); itEntry.hasNext();) {
com.hp.uca.mediation.action.jaxws.ActionResponseItem.Output.Entry entry = itEntry
.next();
theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] – “+id+” – Key=” + entry.getKey() + “, value=”
+ entry.getValue());
strKey = entry.getKey();
if (strKey.equalsIgnoreCase(“EntitySpec”)) {
strRet = entry.getValue();
theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] – “+id+” – Alarm ID – ” + strRet);
bFind = true;
break;
}
}
if (bFind)
break;
}
if(strKey != null) {
Flag flag=new Flag(strRet.toLowerCase(), “CIMD_SIA_PROCESS:” , true);
theScenario.getSession().insert(flag);
}
} else{
theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] : Failure – “+id+” – Alarm ID – ” + action.getActionStatus().toString()+ ” : “+
action.getActionStatusExplanation().toString()+” : “+ action.getActionSubStatus().toString());
}
how to break 1st if loop