...
String str1 = packedSwitch(1);
...
private String packedSwitch(int i) {
String str = null;
switch (i) {
case 0:
str = "she is a baby";
break;
case 1:
str = "she is a girl";
break;
case 2:
str = "she is a woman";
break;
case 3:
str = "she is an obasan";
break;
default:
str = "she is a person";
break;
}
return str;
}
...
.line 14
const/4 v2, 0x1
invoke-direct {p0, v2}, Lcom/droider/switchcase/MainActivity;->packedSwitch(I)Ljava/lang/String;
move-result-object v0
...
.method private packedSwitch(I)Ljava/lang/String;
.locals 1
.parameter "i"
.prologue
.line 21
const/4 v0, 0x0
.line 22
.local v0, str:Ljava/lang/String;
packed-switch p1, :pswitch_data_0
.line 36
const-string v0, "she is a person"
.line 39
:goto_0
return-object v0
.line 24
:pswitch_0
const-string v0, "she is a baby"
.line 25
goto :goto_0
.line 27
:pswitch_1
const-string v0, "she is a girl"
.line 28
goto :goto_0
.line 30
:pswitch_2
const-string v0, "she is a woman"
.line 31
goto :goto_0
.line 33
:pswitch_3
const-string v0, "she is an obasan"
.line 34
goto :goto_0
.line 22
nop
:pswitch_data_0
.packed-switch 0x0 //默认值为0,下面每每加一
:pswitch_0
:pswitch_1
:pswitch_2
:pswitch_3
.end packed-switch
.end method
p0
为方法的第零个入参即this
, p1
为方法的第一个入参手机扫一扫
移动阅读更方便
你可能感兴趣的文章