Use
if ("lamp".equals(DeviceType)) { //do something } The operator, ==, tests to see if two object reference variables refer to the exact same instance of an object.
The method, .equals(), tests to see if the two objects being compared to each other are equivalent -- but they need not be the exact same instance of the same object.
http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html
Check the equals method in the link above