I am using jd-gui to decompile a class fi开发者_如何学JAVAle, and I got a break label (label1076) as below. In eclipse I got an error compiling because the label is declared after it is used. What is the equivalent java code without using break statement?
public List buildChildList()
{
for (int i = 0; i < size; ++i)
{
... for (int i = 0; i < relatedWorkExpressions.size(); ++i) {
...
try
{
...
}
catch (Exception ex)
{
... break label1076: }
...
...
...
label1076: childList[childPosition.intValue()] = child;
}
}
... }
The equivalent unlabeled Java would depend on the logic of code. Given two nested loops, the label probably should precede the outer loop. Breaking out of the inner loop wouldn't require a label, as shown here.
精彩评论