Ask Great God for help to see why if(CmdType==KEY) does not execute here

  java, question
@Override
 public void run() {
 try {
 While(true){ // loop indefinitely to listen for data from the client
 if (msg!  =null) {
 try {
 
 JSONArray jsonObjs = new JSONArray(msg);
 Log.i("TService", "===============>aaaaa");
 for(int i=0;  i<jsonObjs.length();  I add add) {//for loop reads the data sent by the client
 JSONObject jsonobj=(JSONObject) jsonObjs.get(i);  //to Object
 CmdType=jsonobj.getString("CmdType");
 CmdCode=jsonobj.getInt("CmdCode");
 CmdParam1=(float) jsonobj.getDouble("CmdParam1");  //read value cast to float
 CmdParam2=(float) jsonobj.getDouble("CmdParam2");
 CmdParam3=jsonobj.getInt("CmdParam3");
 Log.i("TService", CmdType);
 bracket
 Log.i("TService", "==========>cccc");
 if (CmdType==KEY) {
 Log.i("TService", "==========>bbb");
 try {
 
 Instrumentation instrumentation=new Instrumentation();
 instrumentation.sendKeyDownUpSync(CmdCode);
 } catch (Exception e) {
 e.printStackTrace();
 bracket
 }    else if (CmdType==TOUCH) {
 Log.i("TService", "==========>dd");
 try {
 Instrumentation ins=new Instrumentation();
 ins.sendPointerSync(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), CmdCode, CmdParam1, CmdParam2, CmdParam3));
 } catch (Exception e) {
 e.printStackTrace();
 bracket
 bracket
 else {
 
 bracket
 
 } catch (Exception e) {
 e.printStackTrace();
 bracket
 bracket
 break;
 bracket
 } catch (Exception e) {
 e.printStackTrace();
 bracket
 
 
 
 bracket

This is the code log, which is only printed after = = ===========>cccc. why doesn’t the if start to execute? what is going on here? please help and look at it. thank you very much

String comparison in java, using equals method