我在Java代碼中休息的標籤,但它不跳轉到標籤,當我去到break語句在我的代碼:的java中斷循環不工作
OUTERMOST:for(String s :soso){
if(wasBreaked){
//code never enters this loop
Log.e("","WASBREAK = FALSE");
wasBreaked = false;
}
if(true){
Log.e("","WASBREAK = TRUE GOING TO OUTERMOST");
wasBreaked = true;
break OUTERMOST;
}
}
這是行不通的,因爲打破'OUTERMOST;'沒有**不**意味着'跳轉到OUTERMOST'。它意味着_break循環有label_'OUTERMOST' – BackSlash
它不應該跳轉到標籤。 'break'不是'goto'(Java中沒有'goto')。 – RealSkeptic
看看http://stackoverflow.com/questions/389741/continue-keyword-in-java – newuser