2013-06-02 4 views
-1

블록 외부에서 continue를 사용할 수 없다는 오류가 있습니다. Mult_search라는 레이블이 붙어 있는데 if 조건 (temp11 == 값) 인 경우 프로그램을 실행하고 싶습니다. 사실이었다. 이 오류를 수정하거나 다른 방법을 제안하는 방법을 알려주세요. 자바 라벨에서레이블로 continue 키워드를 사용하는 방법

Mult_search: 
    { 
     if(l1!=(mul) && re1!=0) 
     { 
      temp11=(int)mult[l1][0]; 
      Iterator it4 = a1.iterator(); 
      while(it4.hasNext()) 
      { 
       Integer value=(Integer)it4.next(); 
       if(temp11==value) 
       { 
        l1++; 
        continue Mult_search; 
       } 

      } 
      for(x=0;x<nodes;x++) 
      { 
       if(parent[x][0]==temp11) 
        l=x; 
      } 
     } 
    } 
+1

Java? 언어에 태그를 달아주십시오. – Thilo

+0

Java : First Steps 튜토리얼이 불량합니다. –

+1

no offence..if 가능한 실수를 적어주세요. 조언을 위해 감사합니다. @ MarkoTopolnik – re3el

답변

0

에만 for, whiledo...while 루프 전에 넣어 수 있습니다. 그리고 "전에"는 이전처럼 정확하게 의미합니다

MY_LABEL: 
while(condition){ 
    body(); 
    if(otherCondition) 
     continue MY_LABEL; 
} 

경우에 따라 레이블이 Joe Random Block에만 붙습니다. break도 아니고 continuegoto 대신 사용할 수 없으므로 허용되지 않습니다.

관련 문제