Monday, April 7, 2014

java, android learning in case of a problem statement


public String getType (Uri uri) {

switch (matcher.match (uri)) {
case WORDS:
return "vnd.android.cursor.dir / logan.dict";
case WORD:
return "vnd.android.cursor.item / logan.dict";
default:
throw new IllegalArgumentException ("unknown uri" + uri);
}
}

Each case statement in the above code block Why not add break?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Why are return a plus break
Reply:
Upstairs positive solution
Reply:
cited a floor hjywyj reply:
both return a plus break why
do not have a return is not a break up?
Reply:
reference to the third floor shishenfengbao reply:
Quote: references to a floor hjywyj reply:

Why are return a plus break
do not have a return is not break up?


break is not to continue to determine the following case, improve efficiency, return is a direct return, plus a return would not break; simply because unreachable break after return statement.
Reply:
references, 4th Floor a740169405 reply:
Quote: references to the third floor shishenfengbao reply:

Quote: references to a floor hjywyj reply:

Why are return a plus break
do not have a return is not break up?


break is not to continue to determine the following case, improve efficiency, return is a direct return, plus a return would not break; simply because unreachable break after return statement.
Okay, thank you

No comments:

Post a Comment