jeudi 29 avril 2021

Java, why is toLowerCase() not working in if condition, only print? [duplicate]

I am Java beginner. I dont understand why .toLowerCase() is not working when placed in if condition.

A simple version of my code:

if ( recType.toLowerCase() == "device") {
          System.out.println("done");
      }

it works when recType= "device" ofcourse but when recType="Device", it doesnt convert it to "device" so whats inside the if condition is not implemented!!. Any ideas?

Aucun commentaire:

Enregistrer un commentaire