boolean a=true你就看成int a=1;boolean a=false 你就看成int a=0;这下if(a)就可以理解了吧a=1时 if(a)为真所以执行它里面的代码反之就执行else里面的