TermCommentPost For Break Statement November 30, -00014 Comments1 Min Read You may also like JTextField Change Font of JTextField Example December 1, 2011 Float Wrapper Class Java Float isInfinite Method Example December 1, 2011 Calendar Get current TimeZone using Java Calendar December 1, 2011 AWT Color Set Drawing Mode To XOR Example December 1, 2011 AWT Color Get Darker Version Of Current Color Example December 1, 2011 JTextField JTextField ToolTip Example December 1, 2011 Applet Get Applet Context Example December 1, 2011 Collections Swap elements of Java ArrayList example December 1, 2011 AWT Color Colored Hello World Applet Example December 1, 2011 Collections Find maxmimum element of Java ArrayList Example December 1, 2011 Vector Remove specified element from Java Vector Example December 1, 2011 Basic Java Examples Swap Numbers Without Using Third Variable Java 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
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