Error: unreachable statement
The cause of this error is just like its name. The compiler will never execute it
the following situations will occur: unreachable statement:
(1) write a statement after the return statement
(2) write a statement after the throw statement
(3) define statements after the break and continue statements
(4) “\ u10100″// legal, equivalent to ‘\ u1010’ and string “0”
(5) the shift operator can be used for long int char short byte
(6) the access control character of a class can be public or nothing
(7) goto is a reserved word but not a keyword. Then is nothing
(8) when a superclass type is cast and assigned to an object of a subclass, there is no exception in compilation, but an exception will occur at run time
for example:
while(i<length&&len>0){
if(strs[i].contains(com.substring(0,len))){
continue;
i++;
}else{
len--;
}
}
You can see that the position of I++ in this code is after its continue. After the compiler executes here, it will directly carry out the next cycle, and I++ will never execute.