Boolean.valueOf("1")与Boolean.parseBoolean("1")的取值

Boolean.valueOf(“1”)与Boolean.parseBoolean(“1”)的取值

    boolean r1 = Boolean.valueOf("1");
    boolean r2 = Boolean.parseBoolean("1");
    boolean r3 = Boolean.parseBoolean("TRUE");
    boolean r4 = Boolean.parseBoolean("true");
    boolean r5 = Boolean.parseBoolean("TrUe");

    Log.e("chwn","r1:"+r1+";r2:"+r2+";r3:"+r3+";r4:"+r4 +";r5:"+r5);
E/chwn: r1:false;r2:false;r3:true;r4:true;r5:true

你可能感兴趣的:(Android)