Recently, I received a piece of code like this, but I don't understand what is the next block right after the if
block?
for(byte i = 0; i < 5; i++) {
P: {
if(condition) {
break P;
}
{// what is the syntax of this?
System.out.println("Is else block? no!");
}
}
}
At first, I thought it was shorthand for else
, but I read a lot of documentation on Oracle and when I run the test, even though the condition of if
above is satisfied, the code inside that block also is still executed, so I know it's not else
.
So in the end, what was that block?
Your answer solved my question, I would appreciate it.
Aucun commentaire:
Enregistrer un commentaire